Smoking cannabis can reduce a man's fertility by altering the size and shape of his sperm, research has shown.
More surprisingly, sex in the summer months has a similar effect, scientists say.
Conversely, abstaining from sexual activity for more than six days improved the "morphology" of sperm.
There was also reassuring news for prospective fathers who might be considering drastic lifestyle changes.
Common lifestyle factors including smoking cigarettes and drinking alcohol had little effect on sperm quality.
When less than four per cent of a man's sperm has a normal size and shape, statistics show he will find it harder to father a child and may have to attend an IVF clinic.
Lead scientist Dr Allan Pacey, senior lecturer in andrology at the University of Sheffield, said: "The take-home message is, if you're a habitual cannabis user, stop, and you need to stop for at least three months.
"I can't tell you definitively that your sperm will improve, but that's a reasonable assumption.
"The other side of the story is if you're trying to have a baby, pay attention to the risks, but don't become a monk and make yourself miserable. Recognising that will contribute to happy lives and relationships."
The study, the world's largest investigating the effects of lifestyle on sperm morphology, recruited 2249 men from 14 fertility clinics around the UK.
Participants were asked to fill out detailed questionnaires about their medical history and personal habits.
Scientists compared information from 318 men with less than four per cent normal sperm and 1652 whose sperm was higher quality.
Men in the first group were nearly twice as likely to have used cannabis in the three months before giving a sample, if they were aged under 30.
They were also nearly twice as likely to have produced a sample in the northern hemisphere summer months from June to August.
The scientists believe younger men were most affected by cannabis simply because they were more likely to take higher doses of the drug.
Chemicals in the drug itself, not the tobacco used in "joints", were probably responsible since cigarette smoking had little effect on sperm morphology.
Dr Pacey said the summer influence was unexplained but did not appear to be linked to heat.
"It's complete conjecture on my part, but it could be a sunlight effect - day length affects our hormones and vitamin D in all sorts of ways," he said.
Previous research has shown that only sperm with the right size and shape can easily get past a woman's cervix, which is surrounded by a "quality control" barrier of thick mucus.
Sperm with a poor morphology also swim less well because of their abnormal shape.
"You can compare a sperm cell with an aircraft," said Dr Pacey. "If you've got a sleek aerodynamically-shaped aircraft, it's going to fly better than one that looks like an old biplane with bits hanging off."
The research is published in the medical journal Human Reproduction.