But since the 1980s, when the pragmatic Deng Xiaoping urged his people to learn from the West in an effort to tackle endemic poverty, Chinese leaders have largely set aside the ideological cudgels. In the decades that followed, Adam Smith-style market economics turned former factory workers into millionaires, and it was China’s erstwhile foe, the United States, that smoothed the way for Beijing’s entry into the World Trade Organization.

In the meantime, hundreds of thousands of young Chinese, including the progeny of China’s revolutionary elite, flocked to American universities, often on full scholarships.

But since ascending to power last year, President Xi Jinping has dusted off Mao’s playbook, starting with a secret document distributed among senior leaders that identified seven existential threats to the party, including “universal values” of human rights, Western-inspired notions of media independence and the advocacy of unrestrained free-market economics. “Western forces hostile to China and dissidents within the country are still constantly infiltrating the ideological sphere,” said the notice, known as Document No. 9, which began circulating last summer.

Such paranoia is not entirely unfounded. The United States has long been committed to exporting liberal democracy, and President Obama’s “pivot to Asia” — shifting military resources from the Middle East to the Asia-Pacific region — has been rightly perceived by Beijing as an effort to counter its increasingly aggressive territorial claims in the South and East China Seas.

But Chen Jian, an expert at Cornell University on American-Chinese relations, says the mounting anti-Western invective is largely a tactic aimed at shifting attention from the potential repercussions of a slowing economy, the glaring gap between rich and poor and the jaw-dropping accounts of official corruption that have become daily fare here. “There is a profound sense of vulnerability within the party, even a sense of crisis,” said Professor Chen, who experienced the excesses of the Cultural Revolution as an adolescent in China.

Yet Professor Chen and other analysts say the “hostile foreign forces” narrative is likely to have little impact on the generation of young Chinese weaned on Kobe Bryant and illegal downloads of “Seinfeld.” “Just look at all the students who want to study in the United States,” he said. “I don’t think these anti-American messages are convincing anyone.”

Perhaps, but it doesn’t make life any easier for foreigners living in China, especially journalists, who have endured growing hostility from the authorities. Visas have been denied, the website of The New York Times has been blocked for nearly two years, and even Chinese friends who have studied abroad remain convinced that the Western media is on a mission to harm their country through unflattering coverage.

The government’s anti-Western narrative does not always fall on deaf ears. Last spring, a Chinese friend invited me to join his family for the Lunar New Year holiday. I gladly accepted, but then came the bad news. His mother, a doctor, said it would be better if I didn’t come. “I’m sorry,” my friend said, “but she is convinced all foreign journalists are spies.”