Pregnant women who take common painkillers could unwittingly be putting the fertility of their daughters at risk, a study suggests.

Tests on rats found that when a mother was given paracetamol or the aspirin-like drug indomethacin, her female offspring had fewer eggs than those not exposed to the medicines.

They also had smaller ovaries and gave birth to smaller litters of babies.

Males were affected too, having fewer cells that give rise to sperm later in life. However, their fertility recovered to normal levels by the time they matured into adults.

Despite the fact that foetal development is slower in humans than in rats, scientists say the findings are significant given the similarity of the two species' reproductive systems.

Paracetamol is widely used to treat headaches, while prescription-only indomethacin reduces inflammation and the pain of fever and arthritis.

Professor Richard Sharpe, from the University of Edinburgh's MRC Centre for Reproductive Health, who co-led the study published in the journal Scientific Reports, said: "It's important to remember that this study was conducted in rats, not humans. However, there are many similarities between the two reproductive systems.

"We now need to understand how these drugs affect a baby's reproductive development in the womb so that we can further understand their full effect."

Rats were given the drugs over several days and experienced effects after one to four days.

As well as affecting a mother's immediate offspring, the medicines also appeared to have an impact on subsequent generations.

Granddaughters of the animals given the painkillers while pregnant also had smaller ovaries and altered reproductive function.

Some painkillers may affect the development of "germ cells" that mature into eggs and sperm within the womb, the scientists believe. The reason could be that the drugs act on hormones called prostaglandins which are known to regulate ovulation, the menstrual cycle, and the induction of labour.

Co-author Professor Richard Anderson, also from the University of Edinburgh, said: "These studies involved the use of painkillers over a relatively long period. We now need to explore whether a shorter dose would have a similar effect, and how this information can be usefully translated to human use."

The work was funded by the Medical Research Council and the Wellcome Trust.

Professor Adam Balen, chairman of the British Fertility Society, said: "This is an interesting study of long-term use of paracetamol in pregnant rats and so, whilst we must be cautious extrapolating to humans, it is sensible for pregnant women to minimise use of paracetamol and other painkillers and seek medical advice if they experience problems with significant pain in pregnancy."

The Medicines and Healthcare products Regulatory Agency (MHRA), which issues guidance on medicines, said the study findings would be "carefully evaluated".

A spokesman said: "Women should avoid taking medicines during pregnancy unless absolutely necessary and should speak to their doctor, midwife or pharmacist before doing so.

"Paracetamol is generally considered to be a safe treatment for pain relief during pregnancy but should be taken at the lowest possible dose for the shortest time."

The Royal College of Midwives said the study reinforced its view that pregnant women taking paracetamol should take the lowest possible dose for the shortest possible time.

Its director for midwifery, Louise Silverton, said: "Ideally, women should avoid taking all medicine when pregnant, particularly during the first three months.

"Minor conditions, such as colds or minor aches and pains, often do not need treating with medicines. If women feel they need to take medicines such as paracetamol when they are pregnant, they should talk to their midwife or doctor first. They can also get advice from their local pharmacy.

"Further research needs to be conducted into how paracetamol may affect fertility and hormone levels, as well as examining the long-term developmental effects on testosterone production."