Obama just got closer to closing Gitmo.

The leaders of the House and Senate Armed Services committees announced Monday that they had reached an agreement over a defense bill that would ease the conditions on transfers of detainees held at Guantanamo Bay that the Obama administration has claimed prevented them from emptying the detention camp. The bill, which is now expected to pass both houses, would represent the first time that Congress has eased restrictions on transfers since Republicans took back the House in 2010.

“This starts to untangle the knot at Gitmo,” said Dixon Osburn of Human Rights First. ” I think many in Congress are recognizing, even those who have supported transfer bans in the past, that the US must start to deal with GTMO as the combat operations in Afghanistan end in a year.”

The defense bill would clear the way for the majority of the remaining detainees, 82 out of 162, to be transferred abroad. An earlier Senate version of the bill had also allowed Gitmo detainees to be brought to the US for trial, while the House version had preserved prior restrictions on transfers of detainees. The resulting compromise between the Republican-controlled House and the Democratic-controlled Senate nevertheless leaves intact a ban on bringing Gitmo detainees to the US for trial or imprisonment, leaving a number of detainees to an uncertain fate–even as it paves the way for most of the men currently detained at the facility to leave. More could be cleared for transfer as the administration conducts its reviews of the detainees left at the facility. As a presidential candidate in 2008, Barack Obama vowed to close the detention camp. The defense bill would make it easier to keep that promise, which has remained unfulfilled a year into his second term.

There are a number of reasons why the politics of Gitmo might be shifting. Recently the White House has engaged in an aggressive effort to persuade Congress that the facility should be closed, with high level national security officials lobbying the Hill to get legislators on board. Over the past several months, the White House has appointed two special envoys for closing Gitmo–one, Clifford Sloan, with the State Department, and another, Paul Lewis, who is based with the Pentagon. Advocates singled out Lewis, a former staffer for the House Armed Services Committee, as being particularly effective.

“It’s a very very different effort by the White House,” Chris Anders of the American Civil Liberties Union told msnbc in November.

Federal court rulings have also narrowed the available charges that can be brought against detainees in the military commissions. With the war in Afghanistan ending, the legal authority for detaining people captured there is eroding. Most importantly, faced with the cost of indefinitely maintaining the facility, lawmakers have begun to recoil at just how expensive Gitmo actually is. In July, Secretary of Defense Chuck Hagel testified that Gitmo would cost nearly half-a-billion dollars to maintain over the next year.

“I think the biggest thing that’s driving it is just the understanding that Gitmo is at best a temporary facility and the cost, expense and logistical challenges of keeping it open forever are just not do-able,” Washington Rep. Adam Smith, the ranking Democrat on the House Armed Services Committee, told msnbc in November. ”I think that has shifted the debate.”

Being transferred isn’t the same as being freed. The Center for Constitutional Rights criticized the Obama administration for “forcibly repatriating” Djamel Ameziane to Algeria last week, a decision his attorney J. Wells Dixon said resulted in his client being held in “secret detention” by Algerian authorities.

Federal courts have recently ruled that two of the most popular charges in military commissions, material support for terrorism and conspiracy, could no longer be brought. For detainees the administration wants to charge, it leaves federal courts as the only option for prosecution. But Congress has been unwilling thus far to allow Gitmo detainees into the US for trial.

In 2010, the trial of Gitmo detainee Ahmed Ghailani for his role in the 1998 US embassy bombings ended with him acquitted on all but one of the charges, a result that still left him with a life sentence. Republicans used the outcome of that trial to argue that Gitmo detainees should be tried in military courts–despite the fact that military commissions have resulted in few convictions and more lenient sentences.

Civil liberties and human rights advocates believe that once the Gitmo population dwindles, Congress will eventually allow the remaining detainees to be prosecuted in the US.

“Congress may ultimately be faced with transferring detainees who could be charged with crimes, or opening up the avenue for trial in the US,” Osburn said. “When faced with that choice, I think Congress will finally opt for Article III court trials.”