A candidate backed by ultra-Orthodox Jewish groups is in line to become Jerusalem mayor after a runoff vote for Israeli local elections, results showed Wednesday.
Moshe Leon closed in on victory after his campaign played on fears of the Holy City's secularisation.
Over 51 percent of voters selected Leon while 48 percent supported his secular opponent Ofer Berkovitch in Tuesday's runoff, held two weeks after the first round.
There were still approximately 9,000 votes of soldiers, police officers, disabled people and prisoners to be counted before the interior ministry officially announced the new mayor.
That left Berkovitch -- trailing behind Leon by 6,528 votes -- with only a very small chance of causing an upset.
Leon, who like Berkovitch was a member of the city council, had the support of some ultra-Orthodox factions, including the Shas party, which is led by Interior Minister Arye Deri.
He was also supported by Avigdor Lieberman, who resigned as Israel's defence minister on Wednesday.
Leon, an accountant by training with rich experience in the public sector, is a religious nationalist and not ultra-Orthodox.
The 57-year-old was briefly head of Prime Minister Benjamin Netanyahu's office in 1997.
Deri had invoked the devil on the campaign trail.
"All of our rabbis support (Leon) against a secular candidate who wants to continue secularising Jerusalem and turn our Holy City into a regular city," Deri told supporters in a video on Saturday night.
"Satan is conducting an emergency recruitment and called up all his forces."
Speaking early Wednesday after the results were published, Leon stressed he would work towards unity.
"Jerusalem has chosen togetherness," he said. "I plan, God willing, to be the mayor of all Jerusalem residents."
Berkovitch refused to accept defeat, claiming foul play during voting.
"Our legal team is examining the results," he said.
The ultra-Orthodox constitute over a third of Jerusalem's Jewish population and wield heavy influence in the politics of the city, which has previously had an ultra-Orthodox mayor.
East Jerusalem's 330,000 Palestinians are eligible to vote in the local elections, but the vast majority stay away, refusing to recognise Israeli control over the sector of the city they claim as the capital of their future state.
Israel occupied east Jerusalem in the 1967 Six-Day War and later annexed it in a move never recognised by the international community. It sees the entire city as its capital.
Any mayor must deal with the various factions represented on Jerusalem's 31-seat council.
Berkovitch's faction is the largest with seven seats, and while Leon's faction won no seats, he can still form a coalition with the ultra-Orthodox and national religious groups that supported him.