On July 13, as the House debated an amendment to the 2018 Pentagon budget bill that would have barred the military from funding servicemembers’ gender reassignment surgeries, Secretary of Defense Jim Mattis privately intervened, calling the amendment’s Republican sponsor and asking her to withdraw it from consideration, CNN reports.

The proposal, which would have blocked the military from paying for gender reassignment surgeries and hormone therapy for both service members and their families, was ultimately defeated in the House in a 209-214 vote on Thursday, with 24 Republicans voting against it.

Of the 200 amendments to the $696 billion National Defense Authorization Act that were being debated in the House, the transgender amendment — offered by conservative Rep. Vicky Hartzler of Missouri — was one of the more contentious, CNN notes.

Hartzler had offered and withdrawn a more expansive amendment in June, one that would have reversed an Obama-era policy allowing transgender service members to serve openly. Hartzler told CNN she withdrew the original amendment to defer action until Mattis had established his stance on transgender troops. But this month, after Mattis gave the military another six months to study the issue, Hartzler filed the new amendment.

“I can confirm that Secretary Mattis spoke with Rep. Hartzler yesterday,” Department of Defense spokesperson Johnny Michael told Task & Purpose in a statement. “However, the Secretary regularly engages with members of Congress to discuss issues of importance to the department and I cannot speak to the specific contents of their conversation.”

In her argument for the updated amendment that failed in the House on Thursday, Hartzler framed gender reassignment in the military as an economic issue, as well as a threat to force readiness.

“There are many problems, but funding transition surgeries with tax dollars is problematic because the surgery is very costly,” Hartzler told CNN. “Surgical recovery time decreases the deployability of our soldiers, and funding transition surgeries means diverting money from other defense priorities.”

Rep. Duncan Hunter, a California Republican and Marine Corps veteran, expressed a similar sentiment in an interview with CNN. “You’re joining the U.S. military,” he said. “Choose what gender you are before you serve.”

Last month, Mattis — a former four-star Marine Corps general whose political philosophy remains ambiguous — postponed a decision made by his predecessor, Ash Carter, to end the ban on transgender people serving openly in the military. An end to the ban required the Pentagon’s signoff by July 1. Mattis deferred the decision by six months at the behest of military leaders so the issue can be studied further.

Why exactly Mattis called Hartzler on Thursday to urge her to withdraw the amendment is unclear; however, in his statement to Task & Purpose said, Michael seemed to suggest that if transgender troops are allowed to serve openly, Mattis will ensure that they can do so without suffering any form of prejudice.

“The Secretary’s position is that the Department of Defense will continue to treat all Service members with dignity and respect,” Michael wrote.

Meanwhile, the defeat of the amendment marks a major victory for House Democrats, who saw it as a step backwards for the military, which has been steadily marching towards full LGBT and gender integration since the repeal of “Don’t ask, don’t tell.”

“Make no mistake, the effect and the intent of this unjust and mean-spirited amendment is to ban patriotic Americans from serving our country,” House Minority Leader Nancy Pelosi told CNN. “They are fighting to rip away the health care of thousands of brave service members.”