President Obama gave an interview to Telemundo about the Senate report on CIA interrogations Tuesday evening. (Reuters)

A report that President Obama hoped would end the debate over the CIA’s brutal interrogation program has instead brought into sharper focus the lingering obstacles the president faces as he tries to move the country beyond what he has described as the fearful excesses of the post-9/11 era.

Within hours of the report’s release Tuesday, Obama and one of his most trusted advisers released what appeared to be dueling statements about its conclusions. The president said the Senate Intelligence Committee’s investigation had revealed actions “contrary to our values.” His CIA director, John Brennan, countered that the same techniques had helped “save lives.”

The highly unusual public disagreement between a president and a senior national security official, highlighted the challenges Obama faces as he works to end the war in Afghanistan, fight a new one in Iraq and Syria, and unwind many of the controversial policies implemented after the Sept. 11, 2001, attacks.

Brennan, who has been perhaps Obama’s most trusted national security adviser during the president’s time in office, will play a crucial role in executing Obama’s strategy against the Islamic State and in helping shape the political argument for closing the military prison at Guantanamo Bay, Cuba. Both are essential to Obama’s foreign policy legacy.

In opposing many of the report’s findings, Brennan sided with congressional Republicans, a relationship that has been strained but may now benefit from his break with the president on this issue. His standing within his own agency, which he will address Thursday at CIA headquarters, will also be tested by the report’s release and by his own close relationship with Obama, who has struggled to build a cohesive national security team over his tenure.

In the aftermath of the 9/11 terrorist attacks, the CIA created secret prison sites and used harsh interrogation methods on detainees.

Asked on Wednesday about Obama’s view of Brennan following the report’s release, White House press secretary Josh ­Earnest said the CIA director is someone “the president relies on, on a daily basis, to keep this country safe.”

But Earnest also avoided discussing the apparent split between Obama and Brennan over whether interrogation techniques such as waterboarding, sleep deprivation and rectal hydration produced valuable intelligence.

“These techniques,” Earnest said, “undermine our ability to use this very powerful tool” of leveraging the moral authority of the United States overseas.

The schism with the CIA director is indicative of the broader resistance to Obama’s efforts to take the country off a permanent war footing.

In the remaining two years of his presidency, Obama will work to rein in the chaotic aftermath of an Iraq war he once derided as “dumb,” end the U.S. combat mission in Afghanistan and close an offshore military prison that Obama has called “a mess” and a “misguided experiment.”

The prison at Guantanamo, which Obama has been trying to shutter for the past six years, remains a top priority for the president and a potent symbol of his struggle to translate his principles into an enduring foreign policy legacy.

“He recognizes that it is emblematic of this entire set of policies and we aren’t going to move past this chapter with Guantanamo open,” said Ben Rhodes, Obama’s deputy national security adviser.

The Senate Intelligence Committee’s report on the CIA’s interrogation program listed, for the first time, the names of the 119 detainees who went through the agency’s secret prison system.

Since taking office, Obama has tried to overcome congressional opposition to closing the prison with appeals to American ideals. “Imagine a future 10 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 part of our country,” he urged an audience at the National Defense University last year. “Is this who we are? . . . Is that the America we want to leave to our children?”

In other instances he has tried reason, arguing that the military prison is costly, inefficient and unnecessary. “No person has ever escaped one of our Supermax or military prisons here in the United States — ever,” he said.

Earlier in his administration, Obama insisted that Guantanamo represented bad foreign policy, undermining the United States’ “moral authority” in the world. Brennan, too, has advocated for the facility’s closure.

Of late, the president and his CIA director have settled on a more incremental approach, stepping up transfers of prisoners who have been cleared for release but can’t be returned to their home countries. About half of the 136 prisoners remaining at Guantanamo fall into this category. This week, the United States transferred six inmates — four Syrians, a Tunisian and a Palestinian — to Uruguay.

On his recent trip to Asia, the president pressed several U.S. allies to consider taking some detainees, said a senior administration official who spoke on the condition of anonymity to discuss ongoing negotiations. The official added that the White House expects more transfers “in the coming weeks and months.”

“With persistence and a little bit of luck, we might get the total number of prisoners at Guantanamo down to 50 or 60,” another senior White House official said.

One hope is that the smaller number of prisoners and the passage of time will yield a less emotional debate, making it possible to move the remaining inmates to a prison on U.S. soil.

“The real problem in closing Guantanamo is the politics and not the policy,” said Steve Vladeck, a law professor at American University. “That’s what the president has to change.”

When it comes to the wars in Iraq and Afghanistan, the president has met his goals of cutting troop numbers and ending the U.S. combat mission. The results, however, have often been messy and inconclusive.

Two weeks before Islamic State fighters took Mosul, Iraq’s second-largest city, the president in a speech at the U.S. Military Academy outlined his vision of a foreign policy less reliant on military force. Instead, the United States would use foreign aid, diplomatic alliances and economic sanctions to “steer the currents of history.” U.S. troops would increasingly train local allies to fight their own battles.

In Iraq and Syria, the new model collided with a rapacious enemy: the Islamic State. For now, U.S. ground troops are not taking part in combat. Instead, about 3,000 U.S. troops are advising Iraqi forces on secure bases. The CIA, meanwhile, is training moderate Syrian rebels to battle the Islamic State in that country.

A coalition of more than 60 countries has been assembled, and the United States and its allies are bombing targets in the two countries on an almost daily basis.

White House officials said that the limited U.S. role does not represent a return to a war in a country where the United States once had more than 150,000 troops. “I acknowledge that it perpetuates the notion that we are engaged militarily against a terrorist enemy,” Rhodes said. “But people can and should see the differences here. There’s a big difference between 150,000 troops and 3,000 troops.”

Another big difference: The president has emphasized keeping U.S. soldiers out of combat, elevating the importance of intelligence and covert action that Brennan oversees. “We believe it is a national security objective to not be losing service members in wars,” Rhodes said.

The question facing the White House is whether such low-profile measures will be enough, especially if the conflicts drag on for years with little progress on the ground.

“Time isn’t on our side,” said James Jeffrey, who served as ambassador to Iraq and has pressed for U.S. advisers to accompany Iraqi forces into combat. “I don’t understand why the administration is dragging its heels.”

Meanwhile, Robert Ford, a former U.S. ambassador to Syria, said the U.S. plan to train moderate Syrian forces was “a fantasy.”

White House officials said the U.S. trainers and airstrikes have helped the Iraqis make modest gains in recent weeks and that they expect the country’s forces to retake some major cities from the Islamic State next year. In Syria, the battle probably will stretch well past Obama’s presidency.

For the White House, the focus these days is on “sustainability” rather than victory.

Such talk is not likely to appease those calling for a larger U.S. response in the Middle East. Obama also is keenly aware that many of the people who helped put him in office have become frustrated by his inability to deliver on foreign policy pledges that propelled his candidacy. As Obama shopped for Christmas presents with his daughters at Politics and Prose bookstore — a gathering spot for Washington’s intelligentsia — a fellow shopper yelled a question regarding what the president intended to do about Guantanamo.

“We’re working on it,” Obama replied. “Any other issues?”