Confident China risks becoming arrogant China has long upheld the Communist party's tradition of calling people from other countries "foreign friends." But the past week has served Beijing's foreign residents a reminder that some of their hosts don't regard them as friends at all. Yang Rui, a prominent talk-show host on the English-language programme of CCTV, the national broadcaster, demanded on his microblog on May 16 that the country "throw out the foreign trash." He accused jobless westerners of human trafficking, seducing innocent Chinese girls and spying. Applauding the expulsion of Melissa Chan, the Beijing correspondent of Al Jazeera English, the television network, he wrote: "Shut up and kick out those who demonise China." Some have dismissed his words as just one angry rant in China's online cacophony. But it is part of a growing xenophobic chorus which highlights how China, and the Chinese, are struggling to find their place in the world. Mr Yang's rant came after an announcement by the Beijing municipal government that it would run a three-month crackdown on "three illegals" - foreigners who lack a legal entry visa, a legal residence permit or a legal work permit. The campaign was announced with a cartoon featuring a smashing fist and a hotline number to report suspicious foreigners. The anti-foreign backlash has been triggered partly by videos published online of several separate incidents involving foreigners assaulting or insulting Chinese. These included a drunk British tourist allegedly sexually assaulting a Chinese woman in a Beijing street at night this month, drawing a beating from Chinese men who heard her cries for help. The next week, the Russian cellist of a Beijing orchestra mocked a Chinese woman on a train after she asked him to take his bare feet off her seat. China has long had a deeply conflicted relationship with the outside world. Official history paints China as a victim which has suffered at the hands of foreign invaders and colonisers for more than a century - a narrative that the Communist party uses to underpin support for its monopoly on power. At the same time, China has tried to paint a rosy picture of itself - often at the expense of its own citizens. Even as Chinese people were starving under Mao's disastrous "Great Leap Forward," the regime exported pork at low prices to Eastern Germany. China has since become the workshop of the world and linked itself inextricably with the global economy. Its growing domestic market has attracted hundreds of thousands of expatriate executives and its increasingly affluent middle class is travelling the world more and more each year. And yet as China grows into a world power it is struggling to define its role in the global community. For years, Beijing has been trying to convince the US, as well as its Asian neighbours, that its rise will not threaten them. But warmongering language from retired generals and prominent scholars frequently undermine the government's peace rhetoric. Xi Jinping, the vice-president expected to succeed Hu Jintao as party chief this autumn, shocked western audiences with a speech during a visit to Mexico in February 2009 complaining about "some foreigners who have eaten their fill and have nothing better to do than point fingers at our country." His remarks echo a deeply felt frustration among Chinese diplomats, and increasingly also ordinary citizens, that the world fails to recognise China's achievements and the country is unfairly demonised in the west. While many Chinese are quick to tell foreigners that they envy them their countries" wealth, rule of law or clean environment, foreign criticism of China's shortcomings in those areas often provokes denial or anger. For a citizenry fed on a diet of nationalism, that is unsurprising. Many of the anti-foreigner rants this month have been fed by the anger of people who sorely want a degree of respect that matches their economic and social position but have little room to attack their own government. Beijing has long used nationalism as a steam valve for this problem. But, disturbingly, intolerance towards the outside world is increasingly coupled with a sense that as China returns to its rightful place as a great power, it can afford to ignore what others think. That is a path Beijing should not follow.