An active-duty service member underwent gender reassignment surgery on Tuesday in an operation paid for by the Pentagon.

The surgery was done in a private hospital and was covered by the military's health coverage because a doctor deemed it medically necessary, according to the Associated Press.

Defense Department spokeswoman Dana White said that military hospitals do not have the "surgical expertise to perform this type of surgery" so it was done at a private hospital.

Because the service member "had already begun a sex-reassignment course of treatment, and the treating doctor deemed this surgery medically necessary, a waiver was approved by the director of the Defense Health Agency," White added.

Tuesday's operation was the first such procedure approved under a waiver allowing the Pentagon to pay for the surgery.

The waivers are required and routinely approved for medical procedures that military hospitals are unable to perform, Army Maj. Dave Eastburn told the AP.

NBC News first reported the gender transition surgery, noting that the patient is an infantry soldier who identifies as a woman, according to a source close to the service member.

The surgery comes amid an ongoing debate over whether transgender troops should be allowed to continue to serve in the military.

President Donald Trump tweeted in July that the U.S. government "will not accept or allow transgender individuals to serve in any capacity in the U.S. military," reversing an Obama administration decision to lift a long-standing ban on transgender individuals openly serving in the armed forces.

A month after his tweet, Trump sent a formal order to the Pentagon to implement the ban and gave the Defense Department six months to determine what to do about those currently serving.

Defense Secretary Jim Mattis sent out a memo in September saying that transgender military members can continue to enlist while the Pentagon decides how to implement Trump's ban.

The president also instructed Mattis to stop the use of federal funds to pay for gender reassignment surgeries and medications, except in cases where it is deemed necessary to protect the health of individuals already in the middle of transition.

Last month, a federal judge barred the Trump administration from proceeding with its plan.