Smoking while pregnant reduces the fertility of boys by affecting a key testis gene, researchers say.
Pregnant women are already advised not to smoke
It is already known smoking affects the future fertility of unborn boys, but it has not been understood how.
Aberdeen University researchers found significant reductions in the levels of a gene called DHH, which plays a key role in testicle development.
Small testicles are linked to low sperm counts, the Journal of Clinical Endocrinology and Metabolism reported.
The DHH (desert hedgehog) gene releases the DHH molecule in the testes, which tells other cells what to do and helps control normal testicle growth.
The researchers examined 22 human foetuses between 11 and 19 weeks of pregnancy, looking at the levels of 30 genes key to the development of testicles.
There was no significant change in all but one case - the DHH gene. The study found the foetuses where women smoked 10 or more cigarettes a day had nearly half the DHH gene levels than non-smoking ones.
Lead researcher Paul Fowler said: "This is the first time that the gene DHH, which plays a key role in the male's normal development, has been linked to maternal smoking and fertility problems.
"Our research is still preliminary and a lot more work needs to be done."
Sheffield University expert Dr Allan Pacey, the secretary of the British Fertility Society, said: "It is an often misunderstood subject. Male fertility is often determined by what happens in the womb.
"Previous research has shown beef and pesticides in drinking water can have an impact on fertility.
"We already know smoking is not advised during pregnancy and this helps us to understand why it affects fertility."