A Chinese girl (l.) looks at a foreign tourist at Tiananmen gate in Beijing, China, May 22. First, videos of rude foreigners went viral in Chinese cyberspace. Then, a Beijing police crackdown on visitors without valid visas drew fervent applause. And finally, a state TV host urged his countrymen to toss out the "foreign trash."

Beijing — The question of how the Chinese view outsiders has been a vexed one for centuries, dating back well before 1858 when, under the Treaty of Tianjin, the victorious British forbade the Chinese government to refer to foreigners in its official documents as “barbarians.”

And the issue has raised its head here again in recent days, in the wake of two ugly incidents in which foreigners behaved like, well, barbarians.

Both were filmed by witnesses with camera-phones, and the videos went viral on the Chinese web (they were also aired on state-run TV), sparking widespread outrage. In the first, a drunken young Englishman appears to sexually molest a Chinese woman and is then beaten and kicked by bystanders; in the second a Russian man on a train puts his bare feet on the top of the seat in front of him, and responds to complaints from the woman occupying the seat with a torrent of abuse.

Not long after these videos came to light the Beijing police launched a “strike hard campaign” to expel foreigners without the correct visas, work permits, or residence permits, urging Chinese citizens to inform on suspected illegals. Matters got really out of hand when a prominent talk show host on state-run TV posted a vitriolic xenophobic rant on Sina Weibo, a popular Twitter-like social media platform.

Supporting the police campaign, Yang Rui said he hoped it would “clean out the foreign trash,” urging the authorities to “cut off foreign snake heads.” Foreign spies “seek out Chinese girls to mask their espionage” he charged, and he crowed that “we kicked out that foreign [expletive]” Melissa Chan, the Al Jazeera correspondent expelled from China last month. “We should shut up those who demonize China and send them packing,” he concluded.

This sort of sentiment is not uncommon amongst a certain segment of Chinese public opinion – Mr. Yang’s post drew some criticism in subsequent comments by bloggers but it also attracted considerable support – and the government is not above stirring up such feelings on occasion; Yang has not been publicly reprimanded, let alone fired.

At the same time, Westerners and Western products are sometimes presented and esteemed here as bigger, better, and more admirable. Not long ago a young American photographed sharing his McDonald's fries with an old beggar woman prompted much soul searching about Americans' greater sense of social solidarity.

Changing attitudes

But some observers see signs that as more and more foreigners come to live and work in China, and as more and more Chinese travel abroad or follow Western sports and film stars, an increasing number of people here are taking less extreme views of those once derided and feared as “foreign devils” or idolized as exemplars of modernity.

“There is no single strain of thought any more,” says Yu Hua, a prominent writer. “Some people may think foreigners are superior, some may not, but China is becoming a more mature society.”

That is partly because Chinese are becoming more familiar with foreigners, who were an exotic rarity only 20 years ago but can be found today in almost any city of any size. The number of foreigners entering China leaped from 740,000 in 1980 to more than 27 million last year, according to official figures.

Cultural fear

Historically, says Chan Kwok-bun, a Hong Kong-based sociologist, “Chinese people are quite on guard against strangers in a general sense,” and “foreigners are doubly strangers. There is a deep-seated cultural fear of things that are strange.”

That attitude was fed by China’s experience of foreign invasion by British, French, American, Japanese, Russian, and German armies during the 19th century, he points out, during the period known here as the “century of national humiliation.”

Nor has that experience been allowed to gather historical dust. Chinese government propaganda harps on it constantly in a bid to remind citizens of the fate that awaits a weak nation, and “patriotic education” textbooks used in Chinese schools teach a clear lesson, argues William Callahan, author of “China, the Pessoptimist Nation.”

That lesson, he writes in his book, is that “foreigners – especially Westerners and Japanese – are barbaric imperialist invaders who only seek to exploit the Chinese people” and that “China still cannot trust foreigners and their running dogs today.”

China's confidence

But while China’s historic weakness has inculcated a sense of inferiority, that attitude is countered by Chinese people’s pride in their civilization and in their country’s extraordinary economic achievements over the past 30 years.

“There’s a dichotomy between a sense of inferiority and a sense of superiority,” says Professor Chan. “This sudden move from the lowest to the highest sets up inner turmoil in the Chinese mind.”

Xia Xueluan, a professor of Sociology at Peking University, sees no contradiction in Chinese attitudes. Rather, he says, “people are generally happy to accept foreign products and culture, but they are proud of China’s development which gives them more confidence in themselves and their country.”

“The strain of nationalism is still there,” argues Professor Lynch, “but it is based much more on self confidence rather than on a sense of insecurity and inferiority” as it was a decade ago.

That sense of confidence seems to have fed some of the online debate surrounding a poll organized this week by a famous childrens’ author, Zheng Yuanjie, which asked people whether foreigners should be subjected to stricter visa requirements. Ninety-five percent of respondents said yes.

“We should require of them what they require of us” when Chinese citizens travel abroad, read one comment. “We should not lower our standards to be inferior.”

“There is a perception that foreigners, especially whites, are treated better in Chinese society in terms of position, salary, and perks,” says Chan. “Chinese think that foreigners have a much better life than they enjoy. So incidents of foreigners behaving badly set people off very easily.”

The young Englishman is in police custody. The Russian, who turned out to be a cellist with the Beijing Symphony Orchestra, has been dismissed. And the 600,000 foreigners living in China who generally get by without offending local sensibilities can only keep their heads down and hope that the current storm blows over soon.