The war in Afghanistan is not ending, US government attorneys said in court documents unsealed Friday, undercutting statements President Barack Obama made last December and in his State of the Union address a few weeks later when he formally declared that "the longest war in American history is coming to a responsible conclusion."

But Obama didn't really mean that the war was over, the government now argues.

"Simply put, the President's statements signify a transition in United States military operations, not a cessation …" Andrew Warden, a Justice Department attorney, wrote. "Although the United States has ended its combat mission in Afghanistan, the fighting there certainly has not stopped."

Warden made the argument in a 34-page motion (viewable below as a PDF) filed in US District Court for the District of Columbia in response to a legal challenge by Guantanamo detainee Mukhtar Yahi Naji al-Warafi. The detainee asked a federal court to grant his writ of habeas corpus and set him free because Obama said the war in Afghanistan is over and the legal authorization the US has relied upon to hold him for the past 13 years is no longer valid.

"The government's position is incoherent," David Remes, al-Warafi's Washington, DC-based attorney, told VICE News. "The president says the war is over. The brief says the war isn't over and will never be over. And the government says they are being consistent with what the president said. They are twisting the president's own words. Obama was clearly making the point that the war was over, that hostilities have ended."

Al-Warafi, a Yemeni national held by the US solely on the basis of his alleged Taliban membership, is one of a handful of Guantanamo captives who have filed so-called end of hostilities challenges in federal court arguing that Obama's formal declaration signifying an end to the war in Afghanistan paves the way toward their immediate release from Guantanamo.

"Since the US war with the Taliban in Afghanistan is over, the government has to let a Taliban-only detainee go. There's no need to debate whether the US war with other groups is over," Remes told VICE News last month when he filed the habeas petition.

But the Obama administration is now arguing that the US military is still very much engaged in hostilities in Afghanistan against al Qaeda and the Taliban, and that the war there is unlikely to end anytime soon. Justice Department attorneys have filed hundreds of pages of documents to support their conclusion.

'The president says the war is over. The brief says the war isn't over and will never be over.'

Because the fighting is ongoing, the US argues they can continue to detain al-Warafi and other prisoners at Guantanamo under the 2001 Authorization to Use Military Force (AUMF), in which Congress granted the president the power to detain certain prisoners "under the law of war without trial until the end of hostilities."

The government goes on to argue that, despite Obama's statements declaring an end to the war in Afghanistan, Congress did not repeal or amend the 2001 AUMF, indicating that lawmakers are in agreement with the executive branch that "hostilities have not ceased" and the power to indefinitely detain war on terror detainees is on solid legal ground.

The government said al-Warafi has misinterpreted Obama's statements about the Afghan war's conclusion and has failed to understand that the "relevant inquiry is whether active hostilities have ceased not whether a particular combat mission has ended."

"The President has not declared that active hostilities against al-Qaeda, Taliban have ceased or that the fighting in Afghanistan has stopped," Warden wrote in the government's motion. "Rather, the President's public statements made clear that, in light of the continuing threats faced by the United States in Afghanistan, counterterrorism and other military operations would continue even after the end of the combat mission … [Al-Warafi's] motion should be denied because active hostilities against al-Qaeda, Taliban and associated forces remain ongoing and have not ceased."

Marty Lederman, a Justice Department attorney during Obama's first term, opined in a blog post last month when al-Warafi filed his habeas petition that if the government argued that hostilities in Afghanistan are not over, then "the court would then be confronted with at least two fundamental questions: (i) What are the criteria for determining whether an armed conflict has ended, for purposes of international law (which in turn affects AUMF and other domestic-law authorities)? And (ii) who decides?

"As for the substantive question of how to determine when the conflict has ended, well… it's very complicated, to say the least," Lederman continued. "The intensity and regularity of hostilities between the relevant parties would certainly be important determinants. If, for example, the US and the Taliban rarely exchange fire (or other forms of attack) for an extended period of time, it would become increasingly difficult to sustain the notion that the armed conflict continues between those parties."

The attorney added that "there's no easy formula that explains where, exactly, to draw the line separating 'war' from 'the end of the conflict," and that the question "is typically determined by the political branches."

The Justice Department attorneys argue that the US can still hold al-Warafi even while the administration is trying to fulfill Obama's campaign pledge to shutter the Guantanamo detention facility and repatriate dozens of detainees by the end of the year before Congress implements measures to block transfers, according to a report published last week by the Washington Post.

The government's position in al-Warafi's case could conflict with Obama's larger goal of permanently shutting down the detention facility.

"This goes beyond whether Obama closes Guantanamo or keeps it open," Remes said. The government's brief "is one with the administration's position that it can detain its captives in the war on terror indefinitely. The brief provides a rationale for continuing to hold detainees captured when there in fact was a war."

Last month, Obama announced that, at the request of Afghanistan President Ashraf Ghani, the US would slow the withdrawal of military personnel from the country and leave about 9,800 troops, "at 21 military bases across Afghanistan," according to the court documents.

And if there is any doubt that US military will continue fighting the Taliban and al Qaeda, the government secured a sworn declaration from Navy Rear Adm. Sinclair M. Harris, the vice director for operations for the Joint Chiefs of Staff, who said that while the US combat mission in Afghanistan known as Operation Enduring Freedom has formally ended, the US military has "commenced a new support and counterterrorism mission" in the country, dubbed Operation Freedom's Sentinel.

Operation Freedom's Sentinel "is executed under specified rules of engagement that delineate the circumstances and conditions under which the U.S. forces may engage [redacted]," Harris wrote, noting that the 9,800 troops who will stay behind in Afghanistan will be used to support the new mission.

Harris even laid out the timeframe for when "hostile engagements" the US will participate in will begin, which he said demonstrates why the US still considers Afghanistan "as an area of active hostilities" and why al-Warafi is wrong to assume that the war is over and he should be released.

"The height of 'fighting season' in Afghanistan generally lasts from April until October," he said. "Although it is difficult to predict with specificity, it is probable that instances of hostilities between the United States and enemy forces in Afghanistan will increase throughout the coming months."