Pakistani protesters burn a U.S. flag on July 7, 2011, during a demonstration in Multan to condemn U.S. drone attacks in Pakistan. Such anti-American protests now appear to be on the decline. (S S Mirza/AFP/Getty Images)

During a dozen visits here since the ­attacks of Sept. 11, 2001, Montana resident Doug Chabot sometimes stuck a Canadian maple leaf on his bag. Even then, he dreaded the inevitable lectures from Pakistanis angered by U.S. foreign policy.

But when Chabot returned late last summer, he was surprised by how “welcoming” Pakistanis were.

“There was no anti-American sentiment walking into stores or the markets and, if anything, people were concerned that I thought they hated Americans,” said Chabot, who runs a charity ­focused on educating Pakistani girls.

His experience reflects a subtle but broad shift in Pakistani society as the war in neighboring Afghanistan draws to a close: Anti-American sentiment appears to be going out of style.

The shift has come as Pakistanis appear to be looking closer to home for the causes of — and answers to — the country’s woes, according to interviews with residents, analysts, and current and former diplomats.

A woman holds a candle and a Pakistani flag as she takes part in a protest against terrorism in Islamabad on March 17, 2015. (Reuters)

Those observers say the change is being driven by a Pakistani middle class that is now more supportive of American drone strikes — which have declined precipitously in recent years — particularly since a school massacre by the Taliban that killed about 150 students and teachers in December. And as conflict spreads in the Middle East, there is a growing recognition in Pakistan that sectarian violence in Muslim countries isn’t all driven by the United States. The Obama administration’s efforts to quietly rebuild relationships here are starting to have an effect, analysts say.

“You now don’t even see the usual firebrands coming up with standard anti-American declarations,” said Ayaz Amir, a political commentator and former lawmaker. “There is a sense we have to deal with our own problems, and it is up to us how we handle those problems, and I think anti-Americanism, really, no longer seems that relevant.”

Not necessarily safer

In recent years, as the war in Afghanistan spilled across the border and U.S. drone strikes pounded the Pakistani tribal hideouts of al-Qaeda and other militants, the United States was often the chief target of Pakistani frustrations over a stagnant economy, political turmoil, and the terrorism-related deaths of thousands of civilians and troops.

Newspaper commentaries regularly savaged the United States, and anti-American protests — sometimes violent — were frequent. Poll after poll indicated that Pakistanis viewed the United States, a major provider of aid to Pakistan, with more disdain than people in almost any other ­nation.

But a Pew Research Center poll released in August showed a significant decline in the percentage of Pakistanis who held negative views of the United States — still a majority at 59 percent, but down from 80 percent two years earlier.

The shifting attitudes do not necessarily mean Pakistan is safer for Westerners. Last month an American teacher was shot and critically wounded in Karachi, and three U.S. citizens have been kidnapped and released here over the past two years, according to a recent State Department report. (President Obama recently announced that Warren Weinstein of Rockville, Md., an American who had been captured in Pakistan, was accidently killed in a U.S. drone strike in January.)

But those incidents, carried out by Islamist extremists or criminal gangs, cloud what otherwise has been an improving relationship between the two countries.

Amir said it has been months since he has heard the snide anti-American comments that were once a mainstay of dinner parties and public forums. Although conspiracy theories about U.S. involvement in the region remain rife, he and other analysts say, the tenor of those accusations is settling back into a more tolerant form of skepticism.

“It’s no more just hate heaped upon the United States,” said Allama Tahir Ashrafi, chairman of the Pakistan Ulema Council, which represents 25,000 religious scholars and clerics, some of whom have been vocal critics of the United States. “Because of the serious internal issues that Pakistani society is facing, and also the Muslim world is facing, the focus is not that much on the United States.”

Fueling public anger

For much of its 67-year history, Pakistan was viewed as a hospitable place for adventurous American travelers. But the roots of anti-Americanism can be traced to the 1960s.

Then, anti-American sentiments were driven by young leftists who questioned Pakistan’s Cold War alliance with the United States. Islamic fundamentalism deepened in the mid-1970s and contributed to a 1979 student-led assault on the U.S. Embassy in Islamabad.

Despite that attack, however, expressions of anti-Americanism in Pakistan remained relatively isolated throughout the 1980s as the two countries allied to resist the Soviet occupation of Afghanistan. Obama, then a college student, visited Pakistan in 1981.

But after the U.S.-led military operation in Afghanistan in 2001, Pakistani public opinion shifted.

This was especially true from 2010 to 2013, when a succession of events — the arrest of a CIA contractor who fatally shot two Pakistanis in Lahore, the U.S. raid that killed Osama bin Laden, a U.S. airstrike that killed 24 Pakistani soldiers and news that the CIA had used a polio vaccination campaign to gain intelligence — fueled broad anger.

By the summer of 2012, 3 in 4 Pakistanis considered the United States an enemy, according to a Pew Research Center poll.

Many Pakistanis say anti-Americanism has faded even further after the Pakistani Taliban attack on an army-run school in Peshawar in December. The attack, widely referred to as Pakistan’s 9/11, magnified the threat Islamist extremists pose while making some American actions, such as drone strikes, appear less hostile, analysts say.

“Now, the progressive Pakistanis are choosing to stay quiet,” said Farzana Bari, an Islamabad-based human rights activist. “I personally have been very anti-drone strikes . . . but now I feel like, ‘Okay, if they are dealing with the extremist groups, that is good.’ ”

Public anger toward the United States is now increasingly hard to spot. Last year, Imran Khan, a political figure and former cricket star, struggled to gain public support for a blockade of NATO supply routes to Afghanistan in response to American drone strikes.

This year, after an al-Qaeda attack on Charlie Hebdo magazine in Paris, the decision by several American media outlets to publish some of the magazine’s controversial cartoons of the ­Islamic prophet Muhammad drove relatively few protesters to the streets.

Even controversial American movies generate far less passion here than they would have a few years ago. Little attention, for example, was given to “American Sniper,” which has been criticized as insensitive to Muslims.

Diverting attention

On the campus of Quaid-i-Azam University, several students said the United States just isn’t a major topic of discussion anymore.

“Now, it’s more of a focus on Pakistan’s internal issues, such as terrorism, an ailing economy, jobs and unemployment,” said Syed M. Abdullah, 23. “It’s been a year and a half since there’s been a protest here about the drone strikes.”

Rasul Bakhsh Rais, a political analyst, said the rise of the Islamic State militant group and the broader sectarian struggle in the Middle East is diverting attention away from the United States. Even though many Pakistanis still disdain U.S. military involvement in the region, Rais said they increasingly pin much of the blame on “new actors” such as Iran or Saudi Arabia.

Ashrafi, of the Ulema Council, credits U.S. diplomats for working to overcome tensions. The U.S. Embassy in Islamabad has been reaching out to religious and business leaders while avoiding getting entangled in Pakistani political debates.

“The metaphor that people use for the U.S.-Pakistan relationship over its 65-year-plus history is a roller coaster of ups and downs, peaks and valleys,” said Richard G. Olson, the U.S. ambassador to Pakistan since May 2012. “Our goal over the past few years is to maybe even out this trajectory, and that means, perhaps, you don’t go so high in your expectations, but you avoid falling into a trough when you disagree.”

Whether that can happen might be up to Pakistanis such as Muhammad Usama Khan, 26.

In an interview at the University of the Punjab in Lahore, Khan angrily denounced the United States, which he said was responsible for the deaths of thousands of Pakistanis because it “created the Taliban” in the 1980s.

After the interview was over, however, Khan ran across a parking lot to clarify his remarks.

“But I want you to know,” he added, “I personally like ­Americans.”

Shaiq Hussain in Islamabad and ­
Haq Nawaz in Peshawar contributed to this report.

Read more:

American hostage devoted his life to helping the world’s poor

Hostage deaths raise wider questions about drone strikes’ civilian toll

After years of delays, Pakistan cracks down on violent Islamists

In Pakistan, Taliban massacre of schoolchildren fuels broad outrage