Image copyright Getty Images Image caption The Pentagon spends tens of billions of dollars on healthcare for active and retired service personnel

Amid the fall-out from US President Donald Trump's announcement on Twitter that transgender people will not be able to serve in the US military, one statistic has been frequently raised to draw attention to the comparatively small estimated costs of transgender healthcare.

It refers to the amount the Pentagon spends on erectile dysfunction medication annually: about $84m (£63m), according to the Military Times newspaper.

In contrast, the Rand Corporation think tank estimated last year that gender transition-related health care costs for transgender personnel would increase the military's active duty health budget by $8.4m per year at the most.

But why does the US defence department spend so much on erectile dysfunction drugs?

Older retirees

First, it is worth pointing out that the Military Times' February 2015 report based its figure on 2014 data from the Defense Health Agency.

The spend of $84.2m was for that year, but the newspaper also reported that $294m had been spent on Viagra, Cialis and other such medications since 2011.

It pointed out that this cost the equivalent of more than a few fighter jets.

In 2014, some 1.18 million prescriptions were filled, mostly for Viagra. But who were they for? The answer goes some way in explaining the massive spend.

Image copyright Getty Images

It is true that some of the erectile dysfunction medication went to active-duty personnel.

But the vast majority went to other groups eligible, including millions of military retirees and their family members. In fact, around 10 million people in total are estimated to be covered by the Pentagon's healthcare system, which cost $52bn in 2012.

It is well known that erectile dysfunction is more common among older men - which would explain a hefty bill for retired service members.

In fact, less than 10% of the prescriptions were for active duty personnel, according to the Military Times.

Still, erectile dysfunction among those currently serving in the US military has been increasing since the wars in Iraq and Afghanistan began.

'Psychological causes'

A 2014 study by the Armed Forces Health Surveillance Branch (AFHSB) found that 100,248 cases of erectile dysfunction were diagnosed among active service members between 2004 and 2013, with "annual incidence rates" more than doubling in that time period.

Nearly half of all the cases were due to psychological causes, according to the study.

Media playback is unsupported on your device Media caption Riley Dosh explains why she wants to defend her country

A study published in the Journal of Sexual Medicine in 2015 found that male veterans with post-traumatic stress disorder (PTSD) were "significantly more likely than their civilian counterparts to report erectile dysfunction or other sexual problems", according to the US Department of Veterans Affairs.

One study cited found that 85% of male combat veterans with PTSD report erectile dysfunction, nearly four times the rate among those returning from combat who are not diagnosed with a mental health disorder.

In 2008, the Rand Corporation reported that one in five US veterans of the wars in Iraq and Afghanistan were suffering from PTSD or major depression.

However, a key statistic buried in the AFHSB study of active duty personnel between 2004 and 2013 suggests one should be cautious of reading too much into the links between America's recent wars, PTSD and erectile dysfunction in relation to the military's massive spend on Viagra.

Personnel who had never been deployed were actually more likely to suffer from erectile dysfunction than their counterparts who had been.

Finally, erectile dysfunction is linked to common conditions, including heart disease, high blood pressure, and diabetes.

In 2007, it was estimated that the prevalence of erectile dysfunction among US men was 18%.

In summary: it is a common condition, and the US military pays for the healthcare of millions of men, meaning it spends a lot on Viagra and other such drugs.