An active-duty service member has undergone gender reassignment surgery, the Pentagon said Tuesday.

Defense Department spokesman Dana White said in a statement that the military's health coverage paid for the surgery because the doctor who performed the operation deemed it to be medically necessary.

"Military hospitals do not have the surgical expertise to perform this type of surgery, therefore it was conducted in a private hospital," said White, who added that that because the service member "had already begun a sex-reassignment course of treatment ... a waiver was approved by the director of the Defense Health Agency."

Army Maj. Dave Eastburn said that waivers are required and routinely approved for medical procedures that military facilities don't have the expertise to perform.

The surgery was first reported by NBC News.

The Obama administration last year eliminated the longstanding ban on transgender individuals serving in the military. But President Donald Trump tweeted in July that the federal government "will not accept or allow" transgender troops to serve "in any capacity" in the military. He followed that a month later with a formal order telling the Pentagon to extend the ban. He gave the department six months to determine what to do about those currently serving.

Trump also directed Defense Secretary Jim Mattis to halt the use of federal funds to pay for sexual reassignment surgeries and medications, except in cases where it is deemed necessary to protect the health of an individual who has already begun the transition.

In September, Mattis sent out a memo making clear that transgender service members can continue to enlist, as the Pentagon grapples with how to implement Trump's ban. A high-level panel is studying the issue, and Trump's order was quickly condemned by key members of Congress and has been challenged in court.

A federal judge last month barred the Trump administration from proceeding with the plan.

Because the ban on transgender service members was only removed last year, gender reassignment surgeries have so far been relatively rare.

The Pentagon did not provide additional details on Tuesday's surgery, due to privacy restrictions.

Fox News' Lucas Tomlinson and the Associated Press contributed to this report.