Republicans are battling behind the scenes over an amendment that would ban the Pentagon from funding the gender reassignment surgeries and other transgender-related healthcare of service members.

Members of the House Armed Services Committee rejected the proposal, which was put forward by Rep. Vicky Hartzler (R-Mo.) as an amendment to a Pentagon spending bill.

But supporters of the provision are now working to attach it to another piece of appropriations legislation that is headed to the House floor in the coming days.

The revival of the amendment comes over the objections of some House Republicans — particularly in the moderate GOP’s Tuesday Group — and Defense Secretary James Mattis.

Hartzler put forward the provision on care for transgender troops as an amendment to the National Defense Authorization Act (NDAA); it failed by a 214-209 vote.

Two-dozen Republicans came together with 190 Democrats to vote against the package, but things could shift if it comes up again: six GOP members abstained or didn’t vote on the NDAA amendments.

Many Republicans were shocked that the package failed, an aide said, and lobbyists who had worked on the issue also told The Hill that the outcome was far from certain — even in the moments before the vote.

“We had been working this issue for weeks. At each point, we just had hurdles we had to get over,” said one lobbyist advocating against the Hartzler amendment, who asked for anonymity in order to speak about the process. “Going into that vote that morning that day, my anxiety level was so high because we were so close and it was going to be so tight.”

Mattis called Hartzler at least once, including the day of the NDAA vote, to urge her to withdraw the amendment. Two sources told The Hill that the Defense secretary also spoke with Speaker Paul Ryan Paul Davis RyanBrexit and exit: A transatlantic comparison Five takeaways from McCabe’s allegations against Trump The Hill's 12:30 Report: Sanders set to shake up 2020 race MORE (R-Wis.) last week.

And now the lobbying process is beginning all over again, as the House prepares to vote on the legislation to fund the Defense Department.

The Hill spoke with seven Capitol Hill staffers and lobbyists about the issue, all of whom asked to remain off the record to protect their clients, employers or associates.

Some Republican lawmakers are angry with leaders for allowing the initial amendment to go to a vote last week, and are now fighting to keep it off the table again.

“There are many members who voted in favor of the amendment the first time but are advocating that the amendment not be made in order the second time,” said a Republican aide, mentioning an effort to push leaders. Conservative members are also reportedly pushing hard in favor of the measure.

The House Rules Committee, which is tightly controlled by GOP leadership, will meet Monday and Tuesday to decide which amendments make it into the Defense Department’s appropriations bill, including discussion on the Hartzler amendment.

The Family Research Council, Heritage Action and Alliance Defending Freedom have been among those urging members to support the amendment.

Hartzler and the amendment’s supporters ague that paying for transgender-related healthcare is too high a cost for the government — putting the projected figure above $1 billion over the next decade.

“The job of Congress is to ensure that our military is the most effective, efficient and well-funded fighting force in the world. With the challenges we are facing across the globe, we are asking the American people to invest their hard-earned money in national defense," Hartzler said in a statement. "Each dollar needs to be spent to address threats facing us."

Critics say Hartzler's figure is "fake," pointing two studies from the New England Journal of Medicine and the RAND Corporation that show projected costs of between roughly $2.4 million and $8.4 million.

Last year, the Obama administration ended the prohibition on transgender people serving openly in the military, but set a transition to occur in stages.

The Defense Department is currently reviewing whether to accept new soldiers who identify as transgender.

Opponents of the amendment are pushing back on a number of fronts, including on the basis of LGBT rights and the belief that the Pentagon should be setting military priorities.

“The job of our Armed Forces is to defend our country, and the DoD should be given more leeway than other parts of the executive branch with respect to personnel decisions,” wrote Rep. Justin Amash Justin AmashHouse to push back at Trump on border Ex-GOP lawmakers urge Republicans to block Trump's emergency declaration This week: Congress, Trump set for showdown on emergency declaration MORE (R-Mich.) in a Facebook post explaining his “no” vote on the Hartzler amendment.

“Those who serve in our Armed Forces deserve the best medical care. …. With respect to transgender persons, we should focus on the best science, not the political or philosophical opinions of partisans,” he said.

The Paul Singer-funded Republican LGBT advocacy group American Unity Fund — joined by the Palm Center and OutServe, two organizations that focus on LGBT individuals serving in the military, and Human Rights Campaign — led the charge on marshaling forces on Capitol Hill and the Pentagon against the amendment.

"The politics of these issues should have evolved to a point where leadership isn’t putting members in this position unnecessarily. You have a lot of prominent Republicans who have come a long way on this," said a Republican lobbyist who advocated against the amendment.

While public views on LGBT issues like same-sex marriage have shifted in recent years, transgender advocates say winning support from some Republicans would be an important milestone.

“To have a couple dozen house Republicans and a unified Democratic caucus take that vote to protect the transgender community, I think that’s a watershed moment” for transgender issues, said another Republican lobbyist who worked the issue.

“People are sick of toxic social issues. They’re sick of people playing political games and bully them to use must-pass legislation — in the NDAA or spending bills — to get these victories they otherwise wouldn’t have,” the lobbyist added.

It harkens back to an amendment last year, sponsored by Republican Rep. Steve Russell from Oklahoma, which would have provided a “religious liberty” exemption to an Obama executive order prohibiting government contractors from discriminating against employees on the basis of gender identity or sexual orientation.

Rep. Charlie Dent (R-Pa.), a leader of the Tuesday Group, was among a group of bipartisan lawmakers who launched a failed attempt to override it. The Russell amendment was ultimately removed from the NDAA in the Senate.

“After the Russell amendment, there is a heightened awareness regarding issues affecting the LGBT community,” said the Republican staffer. “People are paying much greater attention to those issues and amendments that affect those issues.”

— Updated on July 25