Babies begin to recognise pain just before they are born, a study has shown.
They learn to tell the difference between pain and touch from around the 35th to 37th week of pregnancy, researchers have discovered.
Scientists measured the brain waves of 25 normal-term and 21 premature babies to look for differences in activity.
As the electroencephalograph (EEG) recordings were made the infants had samples of blood taken by lancing their heels, a routine standard procedure.
Among premature babies, the heel lances produced general bursts of electrical activity in the brain. But after 35 to 37 weeks the babies' response switched to localised activity in specific brain areas.
This showed they were perceiving pain stimulation as an experience separate from touch, said the scientists.
Dr Lorenzo Fabrizi, from University College London, who led the research published in the journal Current Biology, said: "We are asking a fundamental question about human development in this study - when do babies start to distinguish between sensations? In very young brains all stimulations are followed by 'bursts' of activity, but at a critical time in development babies start to respond with activity specific to the type of stimulation.
"Of course, babies cannot tell us how they feel, so it is impossible to know what babies actually experience. We cannot say that before this change in brain activity they don't feel pain."
Previous studies have shown a similar shift from neuronal bursts to focused activity in the brain's visual centre at around the same time.
The research suggests that important nerve connections are formed in the brain during the period just prior to birth.
Co-author Dr Rebeccah Slater, also from University College London, said: "Premature babies who are younger than 35 weeks have similar brain responses when they experience touch or pain. After this time there is a gradual change, rather than a sudden shift, when the brain starts to process the two types of stimuli in a distinct manner."
The findings may have implications for the treatment, care and development of premature newborns, according to Dr Fabrizi. He pointed out that premature babies often grow up to be either more or less sensitive to pain than normal.