WASHINGTON -- President Barack Obama's suggestion Thursday that "history will cast a harsh judgment" if the nation fails to deal with the detainees at Guantanamo Bay in 10 to 20 years might come as a harsh surprise to some of his top military and civilian defense advisers.

That's because they told Congress just one week earlier that the United States could be saddled with the prisoners even longer.

Obama was calling on Congress Thursday to end the laws they have passed restricting the administration from moving the 166 captives who remain at the United States' jail for terrorism suspects in Cuba.

"I know the politics are hard, but history will cast a harsh judgment on this aspect of our fight against terrorism and those of us who fail to end it," Obama said in a speech to the National Defense University. "Imagine a future -- 10 years from now or 20 years from now -- when the United States of America is still holding people who have been charged with no crime on a piece of land that is not a part of our country."

"Look at the current situation, where we are force-feeding detainees who are being held on a hunger strike," Obama said. "Is that who we are? Is that something our founders foresaw? Is that the America we want to leave our children?"

The answer to his rhetorical question was certainly meant to be no, but when the Senate Armed Services Committee questioned a panel of defense officials exactly a week earlier, on May 16, the answer was more like yes.

The hearing was called "The Law of Armed Conflict, the Use of Military Force, and the 2001 Authorization for Use of Military Force." It examined how the United States has been running the war on terror launched under that post-9/11 act of Congress, and whether the authorization was still relevant.

The officials argued that while it might be time to review the AUMF, as the authorization is known, it was currently being used appropriately and would be of use as long as there is a war on terror, or, as the administration describes it, a war on "Al Qaeda, the Taliban and associated forces."

And that war will not end any time soon, defense officials said. "I believe it's at least years in advance, based on my understanding of the organization, of resiliency of Al Qaeda and its affiliate forces. It's many years in advance," Michael Sheehan, the assistant defense secretary for special operations and low-intensity conflict, told Sen. Carl Levin (D-Mich.).

He was even more specific when pressed on the matter by Sen. Lindsey Graham (R-S.C.), who himself sees no soon end to the conflict.

"Yes, sir, I think it's at least 10 to 20 years," Sheehan offered as an estimated timeline for when the war effort may end.

The duration of declared hostilities is a key element of Obama's hopes to close Guantanamo and deal with detainees -- wherever they are held -- because as long as there is a conflict, international law permits the holding of prisoners of that war. When the war ends, the prisoners eventually must be freed.

"There will come a point when our enemy in this armed conflict is defeated, or so defeated that there is no longer an ongoing armed conflict," Robert Taylor, the acting general counsel for the Department of Defense, told Levin. "At that point, we will face difficult questions about what to do with those still remaining in military detention without a criminal conviction and sentence," he said.

But he noted that even after the hostilities are ended, there is precedent for the nation taking even longer to release the prisoners.

"I do point out that, following World War II, we continued to hold some people for several years as part of a general mopping up authority," Taylor said, apparently surprising Levin, who asked if war crimes were involved.

"No, sir," Taylor said. "They were prisoners of war, but who were assessed that they would so disrupt the delicate situation in -- back in Germany and elsewhere, that we held them for a few years."

Before Congress barred the administration from relocating the prisoners held at Gitmo, it had run into exactly that problem, finding it difficult to find countries willing to accept former terrorism suspects.

In spite of those assessments just a week before he spoke, Obama struck a much more optimistic tone for a post-Gitmo world.

"Now, even after we take these steps, one issue will remain, which is how to deal with those Gitmo detainees who we know have participated in dangerous plots or attacks, but who cannot be prosecuted, for example, because the evidence against them has been compromised or is inadmissible in a court of law," he said. "But once we commit to a process of closing Gitmo, I am confident that this legacy problem can be resolved, consistent with our commitment to the rule of law."

WATCH the exchanges above.

Update: 6:33 p.m. -- In a statement to HuffPost, National Security Council spokeswoman Caitlin Hayden said:

What the President said would bring harsh judgment is continuing to hold people who have been charged with no crime and holding them outside our borders. He was explicitly referencing the situation at Guantanamo, and the need to close it. What is true is that we can expect to still be facing a terrorist threat from Al Qaeda and other groups for years to come. But we will not deal with terrorists we capture by sending them to Guantanamo; it remains our strong preference to detain, interrogate and then prosecute in an Article III court or a reformed military commission. We have done it over and over again successfully, including, as the president noted, Umar Farouk Abdulmutallab, who tried to blow up an airplane over Detroit; and Faisal Shahzad, who put a car bomb in Times Square. As he said, it is in a court of law that we will try Dzhokhar Tsarnaev, who is accused of bombing the Boston Marathon. And Richard Reid, the shoe bomber, is as we speak serving a life sentence in a maximum security prison here, in the United States. The president acknowledged that even after we take these steps, we still need to resolve the issue of how to deal with those Guantanamo detainees who we know have participated in dangerous plots or attacks, but who cannot be prosecuted. But, as the president said, once we commit to a process of closing Guantanamo, he is confident that this legacy problem can be resolved, consistent with our commitment to the rule of law."

Michael McAuliff covers Congress and politics for The Huffington Post. Talk to him on Facebook.

Also on HuffPost:

Loading Slideshow...
  • Guantanamo Guard Tower

    Located between Guantanamo's Camp Five and Camp Six.

  • Guantanamo detainee received physical therapy

    A skinny Guantanamo detainee receives physical therapy on Tuesday, April 16, 2013.

  • Empty cell block

    A cell block at Guantanamo's Camp VI that had been occupied until a raid on April 13, 2013. One detainee had written "stop tortur us. stop desclate our relgion" on the wall of his cell. The officer in charge of the facility said that detainees had hoarded all types of materials in the communal area.

  • Guantanamo Camp VI video feeds

    A Guantanamo guard looks over a video screen at Camp VI at Guantanamo in April. Detainees had blocked 147 of the prison's 160 cameras, according to a military official.

  • Weapons

    Water bottles filled with gravel were amongst the weapons officials said they confiscated from detainees after the raid in April.

  • Weapons

    Other weapons included broom sticks and shanks.

  • Occupied block

    A guard checks on detainees in a sparsely populated block of Guantanamo's Camp Six in April.

  • Guantanamo Medical Facility

    Military officials show journalists the room where some detainees were being force fed during the ongoing hunger strike at the facility.

  • Force Feeding chair

    A restraining chair used to feed detainees at Guantanamo.

  • Cans of Ensure at Guantanamo

    A guard displays cans of Ensure used to force feed detainees at Guantanamo.

  • Detainee handprint

    A handprint is shown on a Camp VI cell block that was occupied by a detainee until a raid in mid-April.

  • Detainee shoe

    A shoe from a detainee left on the now-empty cell block.

  • Shower camera

    Cameras are everywhere in Guantanamo's Camp VI, even inside the shower.

  • Cell block

    The second level of an empty cell block in Camp VI as seen from below.

  • Camp VI Sign

    A sign outside Guantanamo's Camp VI.

  • Guantanamo Flag At Half Staff

    A flag flying over Guantanamo's Camp Six flys at half staff in honor of victims of Boston Marathon massacre.

  • Camp Five Guards

    Guards at Camp Five stand watch during morning prayers.

  • Camp Five Cell Block

    An empty cell block in Guantanamo's Camp Five.

  • "Splash" Shields

    Face shields intended to prevent guards from being hit in the face by "cocktails" of urine, feces and semen.

  • Water handoff

    A guard hands water to a detainee on the Bravo block of Guantanamo's Camp Five.

  • Dead Banana Rat

    A dead banana rat on the road to Guantanamo's prison facilities.

  • Sunrise By Guantanamo's Camp Five

  • Obama, Hagel On Joint Detention Group Board

    President Barack Obama and Secretary of Defense Chuck Hagel pictured at the headquarters of Joint Task Force Guantanamo's Joint Detention Group headquarters.