The approaching end of the U.S. war in Afghanistan could help President Obama move toward what he has said he wanted to do since his first day in office: close the U.S. prison at Guantanamo Bay, Cuba.

Blocked by Congress from releasing or transferring many of the remaining 164 detainees and able to try only a small number of them, administration officials are examining whether the withdrawal of U.S. troops at the end of 2014 could open the door for some to challenge the legal authority of the United States to continue to imprison them.

Most immediately, officials believe the war’s declared end could force a reckoning over the detention of more than a dozen Afghan Taliban members captured on the battlefield, allowing them to lodge new appeals to the federal courts.

“In the words of the Supreme Court, the authority to detain — if you’re detaining based on someone being a belligerent — can unravel as hot wars end. And I think that’s a real question,” Brig. Gen. Mark Martins, chief prosecutor for military commissions at Guantanamo, said in a recent interview.

Detainees at Guantanamo have been held, some of them for more than 12 years and most without charge, since Congress authorized the use of military force against those who “planned, authorized, committed or aided” the Sept. 11, 2001, attacks and might launch new attacks.

Ideally, Obama would like to do away with the Authorization for the Use of Military Force, a law passed within days of the 9/11 attacks, and replace it with more targeted versions to allow action against new al-Qaeda related groups in the Middle East and Africa and other threats as they arise. His goal, the president said in a May speech, is to ”refine, and ultimately repeal” the existing authority.

Repeal of the AUMF could allow other detainees imprisoned under its terms to refile habeas corpus petitions that the government had successfully quashed.

“If that were to go away, you really don’t have that legal hook for continued detention,” a senior administration official said of the AUMF. “I think you would have some very interesting constitutional questions.”

While the end of the war may accelerate the transfer of prisoners, the administration would still need a place to hold those being tried in military commissions, including the alleged 9/11 plotters, and potentially some of the four dozen men deemed too dangerous to release but who are ineligible for trial because evidence against them is inadmissable. Congress has prohibited their transfer to U.S. prisons.

No new detainees have arrived at Guantanamo since 2008, when the George W. Bush administration announced the transfer of the last of the 16 “high-value” prisoners from secret CIA and other sites overseas.

Under both the Bush and Obama administrations, the AUMF has provided the legal justification under U.S. law for military action in Afghanistan and for CIA drone attacks and other actions in Pakistan. With no legislative or legal challenge, Obama has also adopted a more expanded interpretation of the law to use force against al-Qaeda “associates,” including groups that did not exist when it was first enacted.

As currently interpreted, the AUMF has no geographic boundaries and can justify military action anywhere in the world where the administration determines it applies. Under Obama, it has been the legal underpinning for lethal strikes against Yemen-based al-Qaeda in the Arabian Peninsula and al-Shabab in Somalia. Earlier this month, it was the cited legal authority for U.S. Special Forces operations that captured Nazih Abdul-Hamed al-Ruqai, also known as Anas al-Libi, in Tripoli, Libya, and the failed attempt to capture an al-Shabab leader in southern Somalia.

But the open-ended nature of the AUMF — along with the distance in time and space between current struggles in the Middle East and Africa and the Afghan conflict that began in 2001 — has left many concerned.

“I never imagined that the AUMF would still be in effect today,” former Rep. Jane Harman (D-Calif.), one of 420 House members to vote in favor of the measure on Sept. 14, 2001, said at a recent conference on the subject.

“Over time, some would assert, and I agree, that it has taken on a life of its own, and the executive branch has used it in ways that no one who voted for it envisioned,” Harman said.

Others have been reluctant to do away with it or narrow its scope, in part because of the potential effect its demise could have on Guantanamo.

The only ironclad waiver to the current congressional restrictions on transferring detainees out of Guantanamo Bay is a court order. “All the folks who remain there have lost — or, depending on your perspective, the government has won -- habeas [corpus] litigation,” said the senior official, who spoke on the condition of anonymity to discuss internal administration deliberations.

“If that goes away,” the official said, a raft of new petitions is expected, along with new pressure on Congress to lift three-year-old restrictions on transfers home or to other countries.

Thus far, the administration has made no move to implement Obama’s goal of narrowing or doing away with the AUMF. An amendment proposed last summer by Rep. Adam Schiff (D-Calif.) to end the authority after the last U.S. combat troops leave Afghanistan in December 2014 was defeated 236 to 180.

Ending the AUMF “forces the issue,” Schiff said in an interview. “It doesn’t mean there would have to be some precipitous decision” on Guantanamo, he said, noting that prisoners of past wars have sometimes been held long after fighting ended. “But the clock would very much be ticking.”

Jeh Johnson, the former general counsel for the Defense Department who has just been nominated to head the Department of Homeland Security, noted in a 2012 speech that the release of some German prisoners of war was delayed for years after the end of World War II, which a 1948 Supreme Court case found was within the executive powers of the president.

But “in general,” Johnson said, “the military’s authority to detain ends with the cessation of active hostilities.”

Billy Kenber contributed to this report.