Two Guantanamo Bay detainees are using President Barack Obama's own words to argue that the U.S. war in Afghanistan is over — and therefore they should be set free.

Two court cases from detainees captured in Afghanistan ask federal judges to consider at what point a conflict is over and whether Obama, in a speech last December, crossed that line when he said the U.S. "combat mission in Afghanistan is ending."

The questions are important since the Supreme Court has held that the government may hold prisoners captured during a war for only as long as the conflict in that country continues.

"The lawyers for the detainees are asking the right questions," said Steven Vladeck, a national security law professor at American University. "And what's really interesting is that the government can't quite seem to figure out its answer."

The court challenges are the latest example of the yearslong legal wrangling tied to Guantanamo, whose status as a prison for terror suspects has long defied resolution. Obama promised to close the prison and has transferred out more than half the detainees who were there when he took office in 2009. In just the last week, six detained Yemenis were relocated to Oman, leaving 116 prisoners.

At its peak, in June 2003, Guantanamo held nearly 700 prisoners. More than 500 were released under President George W. Bush. Obama came into office pledging to close the prison in a year, but Congress stopped him by imposing restrictions on transfers.

Over the last decade, detainees have challenged the military tribunal process used to prosecute them, their treatment behind bars and efforts to force-feed them, among other issues.

The latest arguments, which could presumably be adopted by other detainees captured in Afghanistan, have played out in recent months in the federal court in Washington. No judge has yet ruled, though legal experts say they expect an uphill battle for the detainees, given the deference courts generally afford to the government on matters of national security.

One of the cases was brought by Faez Mohammed Ahmed al-Kandari, a Kuwaiti who was shipped to Guantanamo following his 2001 arrest after the battle of Tora Bora. Another came from Muktar Yahya Najee al-Warafi, a Yemeni whom a judge has determined trained alongside Taliban militants.

The two men, both held without charges, argue that an end to the fighting in Afghanistan means their detentions are now unlawful under the 2001 Authorization for Use of Military Force. That law provided the legal justification for the imprisonment of foreign fighters captured on overseas battlefields.

The Supreme Court said in a 2004 opinion, Hamdi vs. Rumsfeld, that such detention is legal only as long as "active hostilities" continue.

Defense lawyers say Obama unequivocally signaled an end to the military conflict when, on Dec. 28, he declared that "our combat mission in Afghanistan is ending, and the longest war in American history is coming to a responsible conclusion."

In a court filing, lawyers for al-Kandari wrote that "there is no longer a battlefield in Afghanistan in which the United States is sustaining active combat operations. Accordingly, there is no longer a basis under the international laws of war to detain" their client.

But the Justice Department says "active hostilities" clearly persist against the Taliban and al-Qaeda, and that Obama never suggested that all military and counterterrorism operations would be coming to an end.

The government says Obama noted at the time that the U.S. would maintain a limited military presence, and about 9,800 troops remain there, advising and assisting the Afghans and conducting some counterterror missions. Besides, the Justice Department says, questions about the status of war are for Congress and the president to decide, not the courts.

"Simply put, the president's statements signify a transition in United States military operations, not a cessation," government lawyers wrote in April in a reply in al-Warafi's case.

Legal experts expect the Justice Department to fend off the challenges.

"Presidents say things," said Eugene Fidell, a Guantanamo expert who teaches military justice at Yale Law School. He recalled President George W. Bush's celebratory Iraq War speech in 2003, delivered from the deck of an aircraft carrier under a "Mission Accomplished" banner.

"Well, the mission wasn't accomplished," Fidell said. "Perhaps some presidential statements of fact have an aspirational flavor."

Vladeck, from American University, said that "the real question is not whether the government is going to win this round, but how."

"There's going to be some skepticism from the judges about the inconsistencies in the government's position and its limitlessness," he predicted.

___

Follow Eric Tucker on Twitter at http://www.twitter.com/etuckerAP