Image copyright EPA Image caption Mr Purnama looked set to win but could not get enough votes in the first round

Jakarta's first Christian governor has conceded defeat to a Muslim former government minister in a vote seen as a test of Indonesia's secular identity.

Basuki Tjahaja Purnama congratulated his rival after exit polls showed Anies Rasyid Baswedan clearly ahead.

Critics of Mr Purnama had accused him of blasphemy, heightening racial and religious tensions. Mr Baswedan was accused of courting hardliners.

The new mayor takes office in October. Official results come in May.

"We now will come together and forget this campaign. Jakarta is home for all of us," Mr Purnama, popularly known as Ahok, said in a nationally televised news conference.

"We understand that our supporters are disappointed. But don't dwell on it."

Mr Baswedan hinted he would try to heal divisions, saying: "We celebrate diversity... We are all ready to work together again."

Who is Jakarta's new governor?

Image copyright Reuters

Anies Baswedan is a respected academic and a former university rector, who studied in the US under a Fulbright scholarship

Known to be a moderate Muslim, but attracted criticism when he met publicly with Islamist groups during his campaign. His team insists he remains a pluralist

Former education and culture minister dropped from President Joko Widodo's cabinet last year in a reshuffle

Has pledged to improve public education, contain living costs and end forced evictions

Hardline Islamist groups say Mr Purnama, a Christian of Chinese descent, insulted a Koranic verse during a campaign speech and have rallied large crowds against him in recent months. He is now on trial for blasphemy, which he denies.

Correspondents say this made the election a choice between secularism and a growing hardline Islamist movement.

How did polling day unfold?

The run-off election between the two men came after no candidate secured more than half the votes in the first round.

Image copyright AFP/Getty Images Image caption Mr Baswedan (centre) is a former education minister

Shortly after polls closed, unofficial counts by private polling companies showed Mr Baswedan had secured a strong lead, with a margin in the double digits.

Police said the election proceeded "smoothly and safely with no significant disruption". They had warned against voter intimidation.

Image caption Convoys of special military police were put on standby as well

A coalition of hardline Islamic groups supporting Mr Basedan had previously said it would send at least 100 activists to each polling station to monitor voting. But correspondents said they had a very limited presence.

Mr Purnama voted with his family in north Jakarta early on Wednesday morning and urged voters not to be afraid.

Rizieq Shihab, leader of the Islamic Defenders Front which has been leading protests against Mr Purnama, also cast his vote.

Asked by the BBC if his group was damaging Indonesia's pluralist democracy, he said: "Democracy doesn't stop someone from voting for a person from the same religion as you.... Christian vote for Christian, Muslims vote for Muslim."

Image caption Rizieq Shihab (left) is the leader of the Islamic Defenders Front

The election has also seen anti-Chinese sentiment, sparking unease in a country that has seen violence against its Chinese minority in the past.

A number of Chinese Indonesians who turned up to vote told the BBC that they had not been intimidated.

"Politics is cruel. There will be threats, physically or verbally. But I still feel comfortable even though I'm of Chinese descent... So far they only scream out hatred but haven't really acted on it," one voter, Rudi Irmawan, told the BBC.

Image caption Chinese voters were seen at several polling stations

What is the controversy about?

Mr Purnama was accused last year of insulting a Koranic verse during a campaign speech, which he has denied, saying his comments were aimed at politicians "incorrectly" using the Koran against him.

Hardline Islamists have cited that verse from the Koran to support an argument that Muslims should not vote for a non-Muslim leader.

Image caption The hardline Islamist Tamasya Al Maidah group sent activists to polling stations, but their presence was limited

If convicted, Mr Purnama faces a maximum five-year jail sentence. His trial is due to resume on Thursday.

How has it affected the outcome?

Observers say the controversy clearly hurt Mr Purnama's chances. Once considered the clear frontrunner, he won the first round of the election in February with only 43% of the vote, while Mr Baswedan had 40%.

The Jakarta Post has described the campaign as "the dirtiest, most polarising and most divisive the nation has ever seen".

Indonesia is the world's most-populous Muslim country. About 85% of its population are Muslim, but the country officially respects six religions.