The Republican-led House won't block an Obama-era practice of requiring the Pentagon to pay for gender transition surgeries and hormone therapy.

Democrats cast the proposal as bigoted, unconstitutional and cowardly and they won support on Thursday from 24 GOP lawmakers to scuttle the amendment to the annual defense policy bill, 214-209.

Lawmakers are expected to vote Friday on passage of the sweeping legislation following more debate over amendments that are often aimed at addressing specific needs in lawmakers' districts. The policy bill would authorize $696 billion for managing the nation's vast military enterprise in 2018, nearly $30 billion more for core Pentagon operations than President Donald Trump requested.

Congresswoman Vicky Hartzler, Republican of Missouri, on February 12, 2015 in Washington, DC. Chip Somodevilla / Getty Images

The transgender measure crafted by Rep. Vicky Hartzler, R-Mo., would have forbid money from being spent by the military's health-care system for medical treatment related to gender transition. Hartzler portrayed her proposal as a good government plan aimed at assuring military dollars are spent only on critical national defense needs.

Hartzler estimated transition surgeries, which she said most private insurance plans don't even cover, could cost the military $1.3 billion over the next 10 years. Troops who have the surgery require months of recovery, she added, which means they're unavailable to do their jobs.

The Morning Rundown Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"It makes no sense to create soldiers who are unable to fight and win our nation's wars," Hartzler said.

But House Democratic leader Nancy Pelosi called the amendment an attack on the health and dignity of thousands of U.S. service members, and Rep. Steny Hoyer of Maryland, the No. 2 Democrat in the House, said Hartzler intended to "politically denigrate" transgender troops.

"Let us not sink to that level," Hoyer said.

Republican Rep. Duncan Hunter of California said people should decide what sex they are before signing up.

"Figure out whether you're man or a woman before you join," Hunter said. "U.S. taxpayers shouldn't have to foot the bill."

The close vote nonetheless underscored the zeal with which a number of Republicans are seizing opportunities to reverse what they cast as President Barack Obama's social engineering of the armed forces. Transgender service members have been able to serve openly in the military since last year, when former Defense Secretary Ash Carter ended the ban.

Since Oct. 1, transgender troops have been able to receive medical care and start formally changing their gender identifications in the Pentagon's personnel system. A Rand Corp. study found that there are between 2,500 and 7,000 transgender service members in the active-duty military, and another 1,500 to 4,000 in the reserves.

Defense Secretary Jim Mattis decided late last month to give the military chiefs another six months to conduct a review to determine if letting transgender people enlist in the armed services will affect the "readiness or lethality" of the force. However, the delay doesn't affect transgender troops who already are serving openly in the military.

Hartzler, a four-term congresswoman who has been mentioned as a possible 2018 challenger to Sen. Claire McCaskill, D-Mo., has suggested forcing transgender service members out of the military services. But she backed away from her plan last month, saying she would give Mattis and other senior military leaders the room to settle personnel matters internally.

LGBTQ advocacy groups condemned Hartzler's amendment. Ashley Broadway-Mach, president of the American Military Partner Association, called the proposal a "vicious attack on service members who are sacrificing so much and putting their lives on the line for our country."

Follow NBC Out on Twitter, Facebook and Instagram