WASHINGTON — President Barack Obama, in one of the most significant speeches of his presidency, did not simply declare an end to the post-9/11 era. He also offered a vision of America’s role in the world that he hopes could be one of his lasting legacies.

It is an ambitious vision — one that eschews a muscle-bound foreign policy, dominated by the military and intelligence services, in favor of energetic diplomacy, foreign aid and a more measured response to terrorism. But it is fraught with risks and hostage to forces that are often out of the president’s control.

From the grinding civil war in Syria and the extremist threat in Yemen to the toxic U.S. relationship with Pakistan and the withdrawal of U.S. troops from Afghanistan with no clear sense of what comes after, there are a multitude of hurdles to Obama’s goal of taking America off “perpetual war footing,” as he said in a speech Thursday.

One of the most daunting is a sprawling wartime bureaucracy that, after nearly a dozen years, has amassed great influence and has powerful supporters on Capitol Hill.

Nor can Obama escape his own role putting the U.S. on a war footing. He came into office pledging to wind down America’s wars in Iraq and Afghanistan, but within a year had ordered 30,000 more troops to Afghanistan and oversaw a significant expansion of the Bush administration’s use of clandestine drone strikes.

“We have no illusions that there are not challenges,” said Benjamin Rhodes, a deputy national security adviser who wrote Obama’s address. “But we should not be defined by our role in terrorism, by the airstrikes we order or the people we put in prison.”

Of all these threats, Rhodes said the White House was most worried about a surge of extremism in the wake of the Arab Spring. And yet the bloodiest of those conflicts, in Syria, reveals the limits of Obama’s policy. He has steered clear of U.S. involvement, despite signs that extremist groups are making gains.

Amid this uncertainty, it was telling that neither the president in his speech nor his aides afterward made firm declarations about where the U.S. could carry out targeted killings, or about whether drone strikes would be carried out by the Pentagon or the CIA.

Administration officials spoke of a “preference” to use the military to carry out lethal operations, but said that Obama’s hands would not be tied and that he reserved the right to use the CIA to carry out covert strikes in far-off countries.

In a “fact sheet” on new standards for lethal operations issued Thursday, the administration cautioned that “these new standards and procedures do not limit the president’s authority to take action in extraordinary circumstances when doing so is both lawful and necessary to protect the United States or its allies.”

Even if al-Qaida’s core network is routed, Rhodes said, “you’ll want to preserve certain capabilities we’ve developed.” That is a discreet way of saying the U.S., having discovered the grim efficiency of drones, is unlikely to stop using them.

At the same time, Obama put renewed emphasis on diplomacy and foreign aid, saying these were important ways to address “the underlying grievances and conflicts that feed extremism.”

As if to underline his point, John Kerry has proved to be a surprisingly activist secretary of state, plunging into shuttle diplomacy between the Israelis and the Palestinians and becoming the administration’s point man for dealing with the strife in Syria.

But the administration cut the budget of the State Department and the U.S. Agency for International Development by 6 percent, to $47.78 billion, reflecting a broader budget squeeze.

Still, to the extent Obama’s vision is realized, it would radically reorder the power centers in Washington: emboldening the State Department, gradually refocusing the CIA on traditional intelligence gathering, and handing primary responsibility for lethal operations to the Pentagon.

The military’s elite commandos would carry out raids or drone strikes only in exceptional cases; more likely, scores of Special Forces troops would train and advise indigenous forces to combat militants on their soil so large American armies would not have to.

“What we’re trying to do with our strategy is turn it back over to the host country and local forces,” Michael Sheehan, the Pentagon’s top counterterrorism official, said at a hearing last month. “That is the future.”

Left unsaid in the speech was one of the biggest motivations for the new focus: a desire to extricate the U.S. from the Middle East so that it can focus on the faster-growing region of Asia.

As Rhodes put it, “We’d like to leave office with a foreign policy that is not unnecessarily consumed with a militia controlling a piece of desert in Mali.”