– The U.S. House on Thursday unexpectedly defeated a GOP-sponsored prohibition on military funding for transgender medical expenses.

The amendment by Rep. Vicky Hartzler, a Missouri Republican, failed after 24 Republicans voted against it, along with all Democratic lawmakers, in a 214-209 vote. The measure would have barred funds available to the Department of Defense to provide medical treatment (except mental health treatment) related to gender transition.

Minnesota Republican Reps. Jason Lewis, Erik Paulsen and Tom Emmer all voted for the amendment. None of their offices responded to requests for comment on their support of the measure.

Last year, the Pentagon began permitting members of the military who are transgender to openly serve and receive medical treatment. The Department of Defense recently received a six-month delay in implementing a policy allowing people who already identify as transgender to enlist.

The amendment had the support of House Speaker Paul Ryan of Wisconsin. Hartzler has been critical of transgender people serving in the armed forces and has proposed banning them from serving in the military at all. She estimated that surgeries to transition genders could cost the military $1.3 billion.