Unborn babies "practise" facial expressions of pain while they are in the womb, scientists say.
Foetuses have been pictured using 4D scanning technology showing what appears to be pain.
The researchers, from Durham and Lancaster universities, suggest the ability to grimace is a "developmental process" which could help doctors assess the health of a foetus.
The study, published in the journal Plos One, found when the mother was 24 weeks' pregnant, unborn babies were able to make simple expressions such as smiling.
By 36 weeks the children were able to create "complex multi-dimensional expressions" such as pain.
Researchers, who examined video footage of 4D scans of 15 healthy babies, said that the process was "adaptive" and helped the unborn baby to prepare for life after birth.
The study expands on previous research that suggests that facial expressions of healthy foetuses develop and become more complex during pregnancy.
Researchers hope that further investigation will examine whether the development of facial expressions in the womb is delayed if the mother smokes or drinks during pregnancy.
Lead researcher Dr Nadja Reissland, of Durham University's Department of Psychology, said: "It is vital for infants to be able to show pain as soon as they are born so that they can communicate any distress or pain they might feel to their carers and our results show that healthy foetuses 'learn' to combine the necessary facial movements before they are born.
"This suggests that we can determine the normal development of facial movements and potentially identify abnormal development too.
"This could then provide a further medical indication of the health of the unborn baby.
"It is not yet clear whether foetuses can actually feel pain, nor do we know whether facial expressions relate to how they feel. Our research indicates that the expression of foetal facial movements is a developmental process which seems to be related to brain maturation rather than being linked to feelings."
Brian Francis, professor of social statistics at Lancaster University, added: "Modern methods of data analysis enable the development of foetal pain faces to be clearly detected, with the complexity of facial movements making up a pain face increasing in the third trimester."