As Obama counts down the final months of his presidency, Senate Republicans are doing what they can to ensure he can’t keep one of his major campaign promises: shuttering Guantanamo Bay prison camp. (Bill O’Leary/The Washington Post)

Congressional Republicans are starting to declare victory in their bid to keep President Obama from fulfilling his campaign promise to shut down the detention facility at Guantanamo Bay and move prisoners to the United States.

But instead of celebrating, they are scrambling to keep the specter of closing Guantanamo from rising again under a new administration in 2017.

Republicans are proposing changes to the Senate defense policy bill to prevent the Pentagon from even thinking about an alternative facility in the United States. They want to prohibit the Pentagon from spending any money on such plans, require officials to publicize detainee transfers to third-party countries and push the administration to start replenishing the ranks of the facility with detained Islamic State fighters.

“Practically speaking, the clock has run out for the president,” Sen. Pat Roberts (R-Kan.) said this month, attributing his confidence to discussions with Pentagon officials. Roberts has long been concerned the Obama administration might try to house detainees at the Army base at Fort Leavenworth, Kan.

“President Obama’s got nobody to blame but himself when it comes to Gitmo,” said Sen. Lindsey O. Graham (R-S.C.), whose home state holds another potential facility for transferred detainees. “He’s swung and missed … he just doesn’t have the courage to tell the left something they don’t want to hear.”

Obama has been pressing for the closure of Guantanamo Bay prison camp since before he became president, but his efforts to make good on that pledge have been stymied by congressional resistance.

Part of the effort to shut down the facility, which was set up in 2002 to hold suspected terrorists, has focused on transferring detainees to third-party countries. Guantanamo held almost 700 prisoners at its peak in 2003, and 174 in late 2010; at last count, there were 80 detainees at the facility, 28 of whom have been slated for transfers to third-party countries the administration hopes to complete this summer.

But shuttering Guantanamo also depends on transferring a core group of detainees to a facility in the U.S. That’s where problems remain, as lawmakers have put up legal and financial roadblocks, arguing that Obama has not produced a satisfactory plan to make that happen.

The president has pledged repeatedly “to work with Congress to find a secure location in the United States to hold remaining detainees,” as he said in February when he sent Congress a plan to close the facility that Republican lawmakers rejected. It is clear the president is also frustrated by the slow pace of progress.

“I don’t want to pass this problem on to the next president, whoever it is,” he said during the same remarks.

Some congressional Republicans have expressed concerns that Obama might try to go around Congress and build a detention facility by executive order, despite the legal prohibitions.

But while Republicans now seem to believe they are in the clear for the rest of Obama’s tenure, they are taking no chances on what comes next.

For those staunchly opposed to closing Guantanamo, a handful of proposed Gitmo-related amendments to the defense policy bill are insurance against Obama leaving the door open to emptying the facility for the next president.

The defense bill is one of the few must-pass policy measures Congress is likely to vote on this election year. The House has already passed its version; the Senate is likely to vote on its bill next month.

Sen. James M. Inhofe (R-Okla.), for instance, has introduced language to require Congress to publicize planned detainee transfers to third-party countries at least 21 days before they happen. Sens. James Lankford (R-Okla.) and Mark Kirk (R-Ill.) want to cut foreign aid to recipient countries that can’t keep track of the detainees they have received.

Sens. Steve Daines (R-Mont.) and Cory Gardner (R-Colo.), whose state is also on the short list of potential facilities that could receive Guantanamo detainees, are also gathering support for a measure to send captured Islamic State fighters to Guantanamo in order to “capitalize on our intelligence-gathering tools.”

Republicans are not just concerned about last-minute moves by Obama to shutter Guantanamo but the stance of whoever is elected president in November.

While Republican presumptive nominee Donald Trump has pledged to keep the facility open, Democratic candidates Hillary Clinton and Sen. Bernie Sanders have expressed support for Obama’s plan to shutter it.

“Because the president’s still the president of the United States, he can still work on ways to make something else happen,” said Sen. Tim Scott (R-S.C.), who has also campaigned hard against bringing Gitmo detainees to the mainland.

Scott doesn’t even fully trust that Trump wouldn’t try to close or weaken the facility, despite his campaign promises to the contrary. He pointed out that even former president George W. Bush — who oversaw the establishment of the facility — eventually wanted to close Guantanamo, too.

Each of the last seven years, Congress has passed laws barring the administration from using funds to build a facility to house detainees in the United States or to transfer detainees to such a facility.

Those measures have kept the administration from taking any measurable strides toward shuttering Guantanamo, though the Pentagon official in charge of such a potential operation, Deputy Defense Secretary Robert Work, said this month that the “limited time left” to try “lifting congressional restrictions and winning approval of funds to execute closure … make the urgency of action greater.”

Work made those comments in response to Roberts saying this month that he had been assured by Pentagon officials, including Work, that Congress had successfully “run out the clock” on Obama.

Republicans were openly frustrated with the paucity of detail in the administration’s plan when they did submit it in February. There has been no attempt to commission another plan this year.

Correction: The story has been updated to reflect the most recent count of detainees at Guantanamo.