Each year, teams from the National Basketball Association (NBA) play a handful of pre-season games in countries around the world, to broaden the reach of American basketball into other markets. The first of these “Global Games” to be played in China took place in 2004, when the Houston Rockets played the Sacramento Kings in Shanghai. Since then, China – where basketball is among the most popular sports – has become the NBA’s main international focus. From 2015-2018, all of the pre-season exhibition matches took place in China.

But this month’s game in Shanghai, between the LA Lakers and the Brooklyn Nets, took place under a very different atmosphere. The events that normally surround these games, such as press conferences and meetings with fans, were cancelled. Signs advertising the game were taken down. Every single fan in the 18,000-seater stadium was issued with a Chinese flag to wave, and no one wore the jersey of the Houston Rockets.

The tension arose when the Rockets’ manager, Daryl Morey, reposted an image on Twitter that contained the phrase “fight for freedom, stand with Hong Kong”. The tweet was quickly deleted, but not quickly enough. Chinese broadcasters and other companies called off their partnerships with the NBA. But when the NBA offered conciliatory statements, politicians in the US demanded the association stand up for free speech. Last week the NBA commissioner, Adam Silver, told the press that he had been pressured to fire Morey; on Thursday, Chinese state media called the claim “lies” and warned that Silver could face “retribution”.

The NBA is only the latest Western organisation to find itself on the wrong side of China’s authoritarian regime. In the same month, Apple has deleted an app called HKmap, which shows protestors in Hong Kong the location of police units, and the flag of Taiwan from its keyboard (for Chinese users). Meanwhile the video game publisher Activision suspended a professional gamer for saying “liberate Hong Kong” during a broadcast.

Even unintended slights can cause trouble for foreign companies trading in China. The jewellery retailer Tiffany & Co was forced to remove an advert in which a model held her hand over her right eye – a gesture adopted by protesters after a woman was shot in the face with a bean-bag round by police during the demonstrations – while the shoe manufacturer Vans has had to remove designs that appeared to reference the protests.

These incidents are not limited to the current situation in Hong Kong. The German camera manufacturer Leica was forced to “distance itself” from an advert based on the taking of the Tiananmen Square “tank man” photo earlier this year. And last year, Mercedes-Benz issued an apology to China after its corporate Instagram account quoted the Dalai Lama.

Most consumer-facing businesses try to keep away from touchy political subjects. But Western companies are finding that in China, there is no aspect of life that cannot be politicised.

William Callahan is professor of international relations at the London School of Economics and an expert on Chinese politics and foreign policy. Callahan says the angry public reaction to these incidents is informed by media and social media that are “heavily curated by the government, by the Party”. While Daryl Morey's retweeting of an image may seem trivial to Westerners, Callahan says that “the Hong Kong demonstrations are being portrayed, in mainland China, as rioters and terrorists”.

“It fits into this narrative of China as a victim,” he continues. “These things are just one more example of the West victimising China. This is how a couple of generations of Chinese people see the world – it's a stark contrast, between China vs the West, or Japan, or the US, and China has to defend itself, because every negative opinion expressed in the West is seen as part of a grand conspiracy.”

This attitude has been spread very successfully, Callahan says, by China’s “Patriotic Education” programme, which began in the 1990s. It began, he says, as “a direct response to the Tiananmen massacre. The conclusion that Deng Xiaoping drew was that these kids, they're just not well educated, and we need to teach them their own history.” What followed was the introduction of the Party’s version of the national story into textbooks, films, television – and later video games and social media.

The global nature of mass media and social media are now spreading Patriotic Education to other countries. “Since Xi Jinping took power in 2012, there's been much more emphasis on Chinese people, especially ambitious people who are in the Party, to not only agree but to show their agreement with government feelings and government policies, and to perform it on social media,” says Callahan.

But the expanding reach of Patriotic Education also appears to be an aim of China’s foreign policy. One of Xi Jinping’s famous sayings, Callahan points out, is “we Chinese need to tell the Chinese story, and tell the Chinese story well". The government now aims to dictate “a clear China story... not just to people in mainland China, but to the world.”

Callahan says he first noticed the trend taking hold last year, when the hotel chain Marriott sacked Roy Jones, a junior social media manager from Omaha, Nebraska, for "liking" a tweet that described Tibet as a separate country. “And then hotels and airlines changed the way they categorised Taiwan, Hong Kong and Macau, from being separate to being China's Hong Kong, China's Taiwan, and China's Macau.”

He was more concerned to see publishers in Europe beginning to edit their works to fit China’s world view. “Any map in a book that is printed in China... has to coincide with China's official version of how the world looks. And if they don't, the book doesn't get published.” These are books in English, he points out, for publication in the West, but “a lot of Western publishers print their books in China”. The result has been a chilling effect; “a lot of publishers are just telling authors to not have maps, because it's too much trouble."

This chipping away at freedom of speech extends from academia – in 2017, Cambridge University Press was widely criticised after it removed online access to certain articles at the request of Chinese censors – to Hollywood, where franchises from the Bond films to Disney's Christopher Robin have been edited or erased to fit the message of Patriotic Education.

Such censorship works by cumulative effect. Callahan says he imagines that for businesses, “what the government in China is asking doesn't seem like a huge deal. Just recategorise Taiwan – if you're at the United Airlines headquarters, that might not seem like a big deal. It's a big deal for Taiwan, of course. But that sort of salami-slicing of what people can say and do is really quite effective from the Chinese side.”

Such diktats, issued by any other country, would be easily opposed, but China is now the largest consumer market in the world. Its shoppers spend more than $5trn a year. To grow and compete at a global level, businesses such as Apple and Versace – which was forced to apologise for selling a T-shirt that appeared to depict Hong Kong and Macau as independent countries – have no choice but to sell to its 1.4 billion citizens. Callahan says the West is only just waking up to the price of access to this market.

“It's part of a general shift in the last couple of years, from people like journalists and academics worrying about the free speech and human rights of our Chinese friends in China – now we have to worry about our own human rights, and our own free speech.”