Image More than a third of Singaporeans are now foreign-born. Credit... The New York Times

“Good riddance and enjoy hell you piece of mainland trash,” read one of the tamer postings.

Singapore’s government, which has long relied on strict media and sedition laws to maintain ethnic and religious harmony in a multicultural society, has become alarmed by the venom, much of it coming from middle-class Singaporeans. In a recent speech to a parliamentary committee, Deputy Prime Minister Teo Chee Hean defended the country’s immigration policies, saying foreign workers — both educated and unskilled — were indispensable to counterbalance a rapidly aging population and to maintain the momentum of Singapore’s roaring economy.

“Quite naturally, we expect that our new immigrants should adapt to our values and norms, and we get upset if they have not yet done so,” he said, speaking in English, Singapore’s lingua franca. “However, I do agree that we should not let recent reactions towards new immigrants and foreigners undo the good job that we have done in building a strong and cohesive society out of people from many lands.”

More than a third of Singapore’s residents are now foreign-born. While the government has refused to release figures on immigrant origins, officials are quick to stress that the majority of new citizens came from countries other than China, with nearly half from Southeast Asia.

In private, they also note that many of the more outlandishly wealthy arrivistes are just as likely to hail from London, Dubai or New Delhi as from China. Among them is Eduardo Saverin, the Brazilian-born co-founder of Facebook whose decision to trade his American passport for Singaporean residency provoked a tempest in Washington this year.