Men who have a vasectomy have a greater risk of developing the most aggressive form of prostate cancer, a study has found.

Harvard scientists analysed the medical records of nearly 50,000 men and found that those who had the operation were 10% more likely to be diagnosed with the disease.

The study revealed a stronger link with the most serious forms of prostate cancer, with rates of advanced or lethal disease rising by 20% in men who had the procedure. The danger seemed to be highest among men who had a vasectomy before the age of 38.

Cancer charities said the study was "extremely important" and urged doctors to discuss cancer risk with men who were considering sterilisation.

The most dangerous forms of prostate cancer are rare. Over the 24-year study, 1.6% of men developed lethal prostate cancer. A 20% increase would raise that figure to less than 2%.

Kathy Wilson, a co-author on the study at Harvard School of Public Health, said it was unclear how a vasectomy might raise the risk of prostate cancer, but one possibility was that the operation changed the protein composition of seminal fluid made in the prostate. "The underlying mechanisms really aren't known, though, and will require more clinical and experimental studies," she said.

Prostate cancer is the most common cancer in men in the UK. More than 40,000 men a year are diagnosed with the disease. In 2011, nearly 11,000 men died from prostate cancer in Britain.

The Harvard team analysed the medical records of 49,405 men for up to 24 years, from 1986 to 2010. During that time, 6,023 men were diagnosed with prostate cancer, and 811 men died from the disease. One in four who took part in the study had a vasectomy.

Having a vasectomy had no reliable effect on the chances of developing low-grade prostate cancer, but men who had the procedure had a 19% greater risk of lethal prostate cancer and were 20% more likely to be diagnosed with advanced disease than other men.

During the study, reported in the Journal of Clinical Oncology, 16 in every 1,000 men developed lethal prostate cancer. A 20% increase due to vasectomy could raise that number to around 19 in every 1,000.

The study goes a long way to ruling out biases that have undermined previous studies, such as the tendency for men who have had vasectomies to have more medical checkups.

Malcolm Mason, of Cancer Research UK, said: "This is an extremely important study, the largest one of its kind looking at the link between vasectomies and prostate cancer. Importantly, the extra risk of developing prostate cancer after having a vasectomy appears to be small but of the few that do go on to develop the disease, a higher number will develop an aggressive form.

"Vasectomy is still an important option for contraception, but this information should form part of the discussion before a man makes an informed decision as to whether or not it is right for him. Future research should look at a combined analysis of this study with others of a similar nature – and if these findings are confirmed, more research will be needed to work out why vasectomy seems to have this effect on prostate cancer risk."