The district of Tebet, in south Jakarta, has an overwhelmingly Muslim character. In both rounds of the election for the city’s next governor, it backed Anies Baswedan. Anies eventually beat incumbent Basuki Tjahja Purnama – the Chinese-Indonesian and Christian politician better known as “Ahok”– in a poll with a strong religious flavour.

Tebet is also one of the last redoubts of the Betawi, the city’s staunchly conservative original inhabitants, who were among the area’s first settlers.

Back in the early 1960s, thousands more Betawi were relocated there from Senayan district, where then president Sukarno set out to build a sports hub.

Half a century ago Tebet was a hilly, poor, isolated and wooded area. Since then, apart from the odd patch of parkland, it has filled up. Some 200,000 people now live in an area of just under 10 sq km.

With only a handful of high-rise buildings, Tebet is a maze of streets, lanes and tiny walkways and at rush hour the traffic – from gleaming sedans to delivery trucks, motorised rickshaws and motorbike taxis – is nigh on impenetrable.

After election defeat, Jakarta’s ethnic-Chinese governor may escape jail in blasphemy trial

On April 14, 2017, five days before the big vote, Ahok’s running mate Djarot Saiful Hidayat headed to the Jami al-Atiq mosque for Friday prayers. Between the Ciliwung River and a busy rail line, the housing around the mosque is among the most densely packed in Tebet. What happened next has been subject to much media controversy.

Djarot prayed alongside the congregation and was on his way out, stopping to chat and take photos, when the mosque’s managers, it is alleged, suddenly began urging the congregation not to vote for a non-Muslim leader. (This has been a key line of attack against Ahok throughout the divisive campaign. Indeed, Ahok is facing a tortuous blasphemy trial for allegedly making disparaging remarks about the Koran.)

People started proclaiming their support for Anies, at which point Djarot left. Within minutes, the incident went viral on social media.

There were claims that Djarot had been chased out of the mosque. This was then used to stress how Jakarta had been almost poisoned by the election and its anti-Chinese, anti-Christian sentiment. The South Jakarta police later issued a statement clarifying that Djarot was not kicked out per se, although people had catcalled him.

Tebet had also developed a reputation in the past 20 years as a centre for indie boutiques (“distros”), hipster cafes and restaurants drawing in people from across the city. In fact, despite all the inflamed emotions surrounding the election, Bloop, one of the area’s best-known distros, was buzzing with teenage shoppers checking out specially designed T-shirts and hoodies.

Was the mainstream media narrative, that extremists were taking over the city and challenging its hard-won reputation for moderation and diversity, accurate? Was this electoral contest a straightforward struggle between good (Ahok) and bad (Anies)?

In Tebet Dalam, 70-year-old Betawi community leader and former parliamentarian Mahfudz Djaelani runs a travel agency specialising in haj tours.

“For the Betawi, religion (Islam) comes first but that doesn’t mean we don’t accept people of other faiths. I have many Christian neighbours, Chinese and Batak,” he said in his wonderfully rasping voice, using a broad term for Indonesian ethnicities. “It’s about the way you approach others.”

“Yes Tebet voted against Ahok, but it’s wrong to think that it was just because he was Christian. For many people, another factor was his behaviour. Many found him offensive and arrogant. With the Betawi, culture and manners are also very important.”

According to Mahfudz, the Betawi are straightforward people: a good turn to them will be returned tenfold, while a bad one will be repaid with even more interest.

There’s no doubt that Anies benefited enormously from anti-Chinese sentiment. This is something that, having won the city’s top job, he must work hard to address.

But there were other factors at work. Like it or not, voters in Indonesia want their politicians to be cultured and nuanced.

Ahok – with his tough talk and Sumatran style – enthralled and appalled people in equal measure. While there is no doubt that he was a trailblazer for Indonesia’s minorities, his failure to moderate his behaviour made it easier for enemies to attack him.

And his policies – including controversial slum clearances – were popular with the middle class, but drove poor voters to his rivals. So yes, religion was important in the Jakarta elections, but so were personalities and policies.

This also works both ways: Anies must find a way to break the cycle of inequality for the many “wong cilik”, or little people, who have propelled him to power. Failure to do so will see him share Ahok’s fate, regardless of his piety.