Image copyright AP Image caption Observers say the Jakarta governor's case is a test of Indonesia's multi-faith society

Millions of Indonesians are set to elect local leaders, but the focus is on the capital Jakarta, where the city's first non-Muslim governor is fighting not only for re-election but to stay out of jail.

As the BBC's Rebecca Henschke reports, his blasphemy trial is being seen as a test of Indonesia's religious tolerance.

"Jail the governor now!" cries a group of female students outside the Jakarta court where Basuki Tjahaja Purnama is on trial.

They are wearing brightly-coloured headscarves and stand out in a sea of white-robed men yelling "hang the blasphemer".

"He insulted Islam. Not just Islam in Indonesia but around the world. I could never do anything radical like kill him or make a bomb, but I must do something and that's why I am here," says one protester.

Mr Purnama, known widely as Ahok, angered many after he referenced a Koranic verse while on the campaign trail last September.

He told voters they should not be duped by religious leaders using the verse to justify the claim that Muslims should not be led by non-Muslims.

An edited transcript and video of his speech went viral and the case snowballed from there - it is now being played out in a courtroom.

Read more: Who is Jakarta's non-Muslim governor?

Image copyright AP Image caption A protest against the governor on 4 November turned violent in the evening

"That was fodder for the conservative groups to attack the governor," says Ulil Abshar-Abdalla, an Islamic scholar who founded the Liberal Islamic Network.

A political moderate, Ulil now works for an opposing political candidate and believes the statement was naive.

"If the person who said that was an Islamic leader with credibility it would be fine, but he is not. This is Ahok, a Christian assuming a high-ranking position as governor, and he produces such an awful statement. He ignores that we have a rising trend of conservatism in Indonesia today, he should have known that."

Mr Purnama's team privately admits he made a political mistake. He himself has repeatedly apologised and insists he would not insult Islam - the religion of his extended family.

But the implications of an off-the-cuff remark are now immense, and his lawyer, Sirra Prajuna argues that it's no longer just Mr Purnama on trial.

"This is a test for tolerance and our multi-faith society. Indonesia is a pluralist nation that has great respect for different faiths. We cannot let this case sink the dream of our founding fathers who wrote our national motto: 'Bhinneka Tunggal Ika'."

This motto means "Unity in Diversity".

You see it in action every Monday morning when children in public schools across the nation recite the founding principles of Indonesia, known as Pancasila.

Image caption Every morning, children in state schools in Indonesia recite the Pancasila

The first principle is a faith or belief in one God. Despite having the world's largest Muslim majority, the country respects six official religions.

The country's founding fathers agreed to drop the inclusion of Sharia - or Islamic law - in the nation's constitution in 1945, allegedly to accommodate the wishes of religious minorities.

"We must always teach them that our society is diverse" says Edi Kusyanto, the principal of Menteng 01 Primary school.

"Pancasila unites Indonesia as one," says sixth grader Flally after the flag raising ceremony.

Just 9% of the population are Christian but they are the majority in some eastern islands. And on the tourist hub of Bali the majority religion is Hindu. Jakarta is where they meet and live side by side.

But for the protesters calling for Mr Purnama to be jailed, the reasoning is clear: they don't accept him as a senior leader because he is Christian.

"In a Muslim country, leaders should be Muslims," says Sisi Marissa Toer.

Image copyright EPA Image caption The FPI is one of Indonesia's main hardline Muslim groups

A group called the Islamic Defenders Front (FPI) has been leading the protests.

Until now its main activities have been raids on those it believes are committing "sin and vice" - prostitutes, alcohol sellers and people selling food during fasting hours in the holy month of Ramadan - but it has little support from most Indonesian Muslims.

There are also protesters who have rallied in support or Mr Purnama, including Muslims like Nidya.

"He is a good man. He has served the people of Jakarta so well. He is now being defamed. Oh my God it's so hard," she says as she starts to cry.

Image copyright AFP Image caption Heavily armed police guard the governor, often the subject of death threats

But in leading the calls for Mr Purnama to be jailed, the FPI has raised its profile and increased its support base.

One of its spokesmen, religious scholar Ulama KH Misbahul Anam, insists it respects the pluralist constitution.

"When Christians celebrate Christmas here we do not disturb them... because they have the right to practise their religion."

But that tolerance has its limits and he goes so far as to say: "The president can never be non-Muslim."

Before the blasphemy case, Mr Purnama was predicted to win the election by a landslide, but now - running against two Muslim candidates - he is fighting for his political career.

He has also long been a divisive politician. For the middle classes he is a hero: not from the political or military elite, he stands out with his straightforward style.

He has been widely praised for rolling out healthcare and education policies for the poor. He uploads to his YouTube channel videos of him telling off under-performing or corrupt civil servants. At a recent toy fair, action figures of Ahok as a Jedi warrior were on sale.

Image caption Many Ahok supporters believe it is he who is being defamed

Image copyright EPA Image caption At least 200,000 people attended an anti-Ahok prayer rally in Jakarta in November

But controversially, he forcibly evicted thousands of people living along the city's river banks and moved them into semi-state housing blocks on the outskirts of the city, and his opponents say he waged a war against the poor in doing that.

Mr Purnama's other problem is that he is ethnically Chinese, a minority in Indonesia that has suffered a dark past.

This is evident even in the protest, where I saw a man in white robes pulling the corners of his eyes - an attempt to mock the Chinese facial characteristics of Mr Purnama.

Under President Suharto, who ruled for three decades from 1966, Chinese symbols, names and celebrations were banned. In May 1998, at the height of the Asian economic crisis, mobs vented their anger at Chinese-Indonesian shop owners.

Those who lived through those times don't like to talk about it, but one elderly lady in a Chinese temple described the time.

"There was violence because of politics and we, the Chinese-Indonesians, became the targets. Lots of Chinese girls were raped. We still don't feel comfortable living in Indonesia. We can't relax and need to always be on guard."

It was not until 2002, when pluralist Islamic leader Abdurrahman Wahid became president, that all restrictions on the community were lifted. He made Confucianism one of the country's official religions.

Image caption Many among the Chinese minority are worried about escalating anti-Chinese sentiment

But openly anti-Chinese speeches at the anti-Ahok rallies and growing racism on social media have many ethnic Chinese concerned. There is even talk among some about leaving the country if the government does not provide the necessary security.

"The whole world is watching, not just Indonesians, not just the people who live here," Anna, a Christian Chinese-Indonesian who didn't want to give her full name, said.

Governor Purmana's rise to one of the country's most prominent positions was seen as an example of Indonesia's commitment to religious tolerance.

Now his trial is testing Indonesia's multi-ethnic and pluralist society in a way it hasn't been for years.

Hear more: Standing Trial for Blasphemy by Rebecca Henschke on the BBC World Service