Image copyright Facebook Image caption Violence broke out at a mall in Kuala Lumpur after two Malay men were arrested for stealing a phone from a Chinese shopkeeper

A sequence of events which started with a relatively minor crime led to big trouble in Malaysia - and led to social media chatter that exposed the country's underlying racial tensions.

It started with a seemingly minor incident. In a shopping mall in Kuala Lumpur, two Malay men were haggling with a Chinese shopkeeper. The men then made off with a mobile phone. They were caught and arrested - and that's when the real trouble started.

"One of the men was released and he returned a few hours later with seven more Malay men who claimed to have been scammed by the Chinese shopkeepers," says Shannon Teoh a journalist with Singapore's Straits Times newspaper who was on the scene shortly after trouble broke out. "The group turned up at the mall looking to pick a fight. They were beaten back by the shopkeepers."

A brawl broke out and it was filmed by a bystander who uploaded the video to Facebook. This resulted in a deluge of racist comments about the Chinese community in Malaysia. Many jumped to the defence of the thief and his friends. "I salute you seven people!" wrote Facebook user Syukri Naim. "Despite getting whacked by many you didn't retreat!!!" The video of the incident has been viewed almost 800,000 times on Facebook and shared on chat applications and Twitter.

And that wasn't the end of it. That evening more than a hundred people gathered outside the mall. Several people were injured including a Chinese photographer and a Chinese journalist. A group of Chinese people in a car were attacked during the violence that ensued. What started out as an isolated case of petty theft, escalated into a series of racially charged events.

BBC Trending Radio

Hear more about this story on the BBC World Service - you can stream our radio programme or download our podcast.

So why did a relatively minor crime which happened a week ago (Saturday 11 July) touch off such huge unrest? The main reason is the underlying tension between ethnic Malays and the Chinese community in Malaysia, says Tse Yin Lee of BBC Monitoring. "Racial stereotypes lead some to believe that the Chinese are taking all of the good jobs and earning more money than Malays themselves," she says. "This incident really highlights how potent racial stereotypes are in Malaysia and how quickly dissatisfaction over what seems to be an inconsequential incident can quickly tip into organised violence."

The authorities moved quickly to try to defuse the situation. Police issued a statement on Twitter to say their investigation was about crime, not race. Even the Prime Minister Najib Razak got involved. In a post on his Facebook page, Razak issued a warning: "This should be viewed as a criminal case rather than a problem of racism. I can see pictures that have nothing to do with this case all over social media. We need to avoid mob psychology and check the facts."

Image copyright Getty Images Image caption Malaysian Prime Minister Najib Razak tried to quell the fighting with a statement released on Facebook

But not everyone heeded the Prime Minister's call - the "pictures that have nothing to do with this case" that he referred to included fake and old photos which were shared along with captions describing them as depicting the violence at the mall, all of which added to the tension.

But there's also been a counter movement online, and some people are urging an end to the racial insults. To take just one example, a selfie published on Facebook by a Malay man with one of the Chinese shopkeepers went viral. In the caption accompanying the image, the Malay man compliments the shopkeeper, saying he's always been treated very well by him.

Image copyright Fais Al-Hajari / Facebook Image caption This image of friendship between a Malay man and a Chinese shopkeeper went viral

"It hasn't all been negative. The authorities have used social media very effectively in this case to quickly take control of the issue and there are many instances of people using it to challenge racial comments, reassure other races and voice their abhorrence of what happened," Lee says. "So there is hope that the country will eventually move past these stereotypes."

Blog by Anne-Marie Tomchak

Reporting by Sam Judah and Mike Wendling

Next story: What did pilgrims show from inside the normally closed city of Mecca?

Image copyright AFP

For the first time Muslims performing their Ramadan pilgrimage in the Saudi city of Mecca, a city typically closed to non-Muslims, were able to share their experiences live with the rest of the world via a popular chat app.READ MORE

You can follow BBC Trending on Twitter @BBCtrending, and find us on Facebook. All our stories are at bbc.com/trending.