JAKARTA, Indonesia — Anies Baswedan, a former education minister and university rector, was sworn in as governor of the Indonesian capital on Monday, ending the most bitterly contested race in the country’s democratic era and one that has raised questions about the Muslim-majority nation’s tolerance for ethnic and religious minorities.

Mr. Anies, 48, was sworn in on live national television by President Joko Widodo at the State Palace complex in Jakarta.

However, one prominent politician was notably absent: Basuki Tjahaja Purnama, Jakarta’s recently departed governor, who is serving a two-year prison sentence after being convicted of blaspheming Islam. He says the case was orchestrated by his political opponents to sabotage his re-election.

Mr. Basuki, 51, who is ethnic Chinese and popularly known as Ahok, was the incumbent governor and was handily leading in opinion polls over Mr. Anies and other candidates when he was accused of violating a blasphemy law by citing a verse from the Quran in a speech in September 2016 to argue that it was acceptable for Muslims to vote for a non-Muslim candidate.