For much of the past seven years, President Obama has labored to move the United States off a war footing abroad and keep the threat of terrorism in perspective at home.

The Paris attacks and their after­math are testing the limits of that approach and the patience of a country that is questioning whether the president truly understands the terror threat.

Obama’s response to the attacks also raises a more political question: Why hasn’t a man known for his rhetorical gifts done more to address the fear the attacks instill in ordinary Americans?

That fear was evident in the efforts of more than two dozen governors to bar Syrian refugees from coming to their states — a response that Obama described as panicky, cynical and un-American. The governors responded that they were just trying to keep their citizens safe. The same concern was manifest in calls from Republicans and some prominent Democrats for Obama to adopt a more aggressive strategy in battling the Islamic State.

The president has described the Paris attacks as “heartbreaking” and has said he understands why “the American people have been particularly affected by the gruesome images that have happened there.”

In five attacks from 2012 to 2015, alleged assailants were born in Europe and ideologically​ motivated. (The Washington Post)

On his nine-day trip through Asia, though, Obama has refused to adopt the more bellicose, aggressive or resolute pose that his critics seem to be demanding. He has repeatedly insisted that neither he nor his foreign policy team has underestimated the threat.

The president’s steadfastness — some call it stubbornness — reflects the lessons he took from the aftermath of the 9/11 attacks, a period in which he has said the country fell into a “season of fear” that led its leaders to betray core American values. His determination not to let the battle against the Islamic State dominate the last year of his presidency also reflects a widely shared belief in the White House that the fight against terrorism amounts to something of a zero-sum game.

The more time, energy and resources that Obama spends focusing on the terror threat and the chaos in the Middle East, the thinking goes, the harder it will be for him to make progress on issues that are critical to the country remaining the world’s strongest power in the decades to come.

Following the Iran nuclear deal, deputy national security adviser Ben Rhodes summed up the president’s philosophy for an audience at the Aspen Ideas Festival.

“Here’s what this is all about — the Obama doctrine and our whole foreign policy,” Rhodes said in June. “We have to reposition the United States to be able to lead in this century.” When Obama came into office, the United States had 180,000 troops fighting in Iraq and Afghanistan, two countries that Rhodes maintained “frankly are not going to dictate the course of the 21st century.”

Map: What a year of Islamic State terror looks like

It has become something of a gospel in the White House that none of the big foreign policy initiatives of the president’s second term — a major trade deal in Asia, the opening to Cuba, the nuclear deal with Iran — would have been possible without Obama’s push to wind down America’s wars and de-emphasize the global war on terror.

“When we came into office, the amount of bandwidth that the United States was spending in Iraq and Afghanistan was extraordinary,” Rhodes said in an interview in September. “It was most of what was being done in foreign policy.”

For Obama, the frustration and panic the Paris attacks have provoked at home are both completely understandable and a stark reminder of the dangerous overreaction such strikes can produce. Obama, a president entering the final year of his second term, no longer feels compelled to shade his beliefs to the demands of public opinion.

To some historians, the moment is reminiscent of the furor and worry that enveloped the country following the Soviet Union’s launch of the Sputnik satellite in 1957. President Dwight D. Eisenhower, who was determined not to increase defense spending, dismissed the public’s fears, calling the satellite “one small ball in the air, something that does not raise my apprehensions one iota.”

“You get the sense that Obama feels the same irritation,” said Stephen Sestanovich, author of “Maximalist: America in the World from Truman to Obama.” Eisenhower’s approach eventually proved out of step with the country’s mood, and he was forced to boost defense spending. The lesson: “It’s not good politics to display your irritation with the American people,” Sestanovich said.

For now, Obama is resisting pressure to change his strategy or escalate America’s military involvement in Iraq and Syria. Visiting the Philippines on Thursday, Obama again emphasized to reporters that defeating the Islamic State would be a “multi-year task” requiring smart diplomacy and a determined effort to build up local security forces.

He suggested that the worry over terrorists concealed among Mideast refugees would fade. “My expectation is, after the initial spasm of rhetoric, that people will settle down,” Obama said.

To the president’s backers, his steadfastness is a sign of strength. “He doesn’t believe in empty gestures or bombast as a substitute for action,” said Derek Chollet, a former senior administration official.

For Obama, the fearful — and, to his mind, politically craven — reactions to the Paris attacks at home are a bitter disappointment and yet another reminder that in many ways the nation remains on a war footing.

“As you are well aware, I do not support the idea of endless war,” Obama said last month even as he was announcing that he would have to break a campaign promise and keep 5,500 troops in Afghanistan beyond the end of his presidency.

His latest plan to close the military prison at Guantanamo Bay, Cuba — a goal he first tackled on his second day in the White House — was supposed to come out last week. In the wake of the Paris attacks, it has been shelved indefinitely.

Despite the setback, Obama promised to try to shut Guantanamo before he leaves office, calling it “an enormous recruitment tool” for terror groups and “part of how they rationalize and justify their demented, sick perpetration of violence on innocent people.”

Even more concerning to Obama are the calls from an overwhelming majority of Republicans to turn away Syrian refugees out of concern that their numbers might include some Islamic State operatives. “Shameful” was the word the president used this week to describe calls from some presidential candidates to only accept Christian refugees.

He returned to the topic Thursday, saying, “I think that there is just a very strong tendency for us to get worked up around issues that don’t actually make us safer but make for good political sound bites.”

Obama’s frustrated tone reflects a widespread belief among terrorism experts that turning away Syrian refugees feeds the Islamic State’s narrative that the United States is at war with Islam. “He is trying to avoid letting the heightened emotions of the moment get spun up into bad policies — policies that might even inflame our problems in the Islamic world even further,” said David J. Rothkopf, the author of “National Insecurity: American Leadership in an Age of Fear.”

The president’s anger is also rooted in a bigger, more existential worry he has about the country. From his first days on the national political stage, Obama has insisted that America’s greatest strength — the root of its exceptional nature — rests in its diversity and willingness to offer those who have suffered hardships and repression overseas a chance at a better life. This was the theme that infused his remarks after the Boston Marathon attacks in 2013. “One of the reasons the world knows Boston so well is that Boston opens its heart to the world,” Obama said from the pulpit at the city’s Cathedral of the Holy Cross.

For Obama, the anti-refugee fervor that the Paris attacks have provoked is more than just political pandering. The events of the last week are a stark reminder for him that the post-9/11 “season of fear,” which he had hoped to move the country past, hasn’t yet ended.