Even as his government was making red-carpet plans to host President Obama this week, the Chinese president, Xi Jinping, praised a young blogger whose writing is best known here for its anti-American vitriol.
In one widely circulated essay published by state news outlets titled "Nine Knockout Blows in America's Cold War Against China," the blogger, Zhou Xiaoping, argued that American culture was "eroding the moral foundation and self-confidence of the Chinese people." He compared unfavorable American news coverage of China to Hitler's treatment of the Jews. In another essay, he said the West had "slaughtered and robbed" China and other civilizations since the 17th century, and was now "brainwashing" it.
Mr. Xi, speaking at a forum last month aimed at tightening political control of the arts, said the blogger exhibited "positive energy."
His embrace of Mr. Zhou, who has been hailed by propaganda officials but widely mocked by scholars here, is just the latest sign of rising anti-Western sentiment, bordering on xenophobia, that has emanated from the highest levels of the Communist Party and sent a chill through Chinese civil society and academia.
Using ideological language reminiscent of the Cold War, Chinese officials have voiced conspiracy theories with relish, accusing foreigners, their companies, national agencies and non-governmental organizations of plotting to weaken or overthrow the party. Chinese institutions with ties to Western entities, no matter how benign, have also come under attack. Meanwhile, state-run newspapers have taken to blaming "hostile foreign forces" for any major disturbance, whether it is ethnic violence in western China or student-led pro-democracy demonstrations in Hong Kong.
The vilification of foreigners as enemies of China has been a staple of propaganda by the Communist Party since before its rise to power, and analysts say the leadership tends to ramp up such rhetoric when it feels under pressure at home.
"Historically,during every period with many deep conflicts within the country, there has been a surge of anti-foreign sentiments from the party," said Zhang Lifan, a historian, pointing to Mao Zedong's disastrous Cultural Revolution as an example. At the moment, he said, "the political establishment needs the public to turn their rage toward foreign countries" because anger over the widening gap between rich and poor in China has reached "crisis levels."
But unlike earlier campaigns targeting the West, the current wave of nationalism comes as China is ascendant. Mr. Xi presides over a country that is on the verge of overtaking the United States as the world's largest economy and that enjoys influence around the world, especially in Asia, where it has sought to expand its territorial footprint.