Challenger Aliza Bloch unseated Moshe Abutbul as mayor of the city of Beit Shemesh by a razor thin margin early Thursday morning, after an all-night vote count to cap the drama-filled race.

Bloch, once seen as a dark horse candidate, entered Wednesday evening trailing Abutbul by 251 votes with 99 percent reporting. A count of provisional ballots by soldiers, prisoners and special needs voters overnight managed to push her past Abutbul by 533 votes.

The win by Bloch will mark a sea change in the city of 80,000 nestled in the forested foothills of the Judean mountains. A large influx of ultra-Orthodox families over the last decades has largely shifted the character of the city and led to incessant religious friction.

Get The Times of Israel's Daily Edition by email and never miss our top stories Free Sign Up

The first woman to ever run for mayor of the city, let alone win it, Bloch is part of a wave of females leading cities for the first time, including Haifa’s Einat Kalisch Rotem, who became the first female mayor of a major city a day earlier.

Abutbul, himself ultra-Orthodox and a member of the Shas party, served as mayor since 2008. In 2013, he barely squeaked past the secular Eli Cohen by less than 1,000 votes, in a race later contested over claims of irregularities at the ballot box.

Bloch also ran for mayor in 2013, first as the Jewish Home candidate and then as an independent after a falling out with national leadership of the right-wing party, but lost to Cohen in a primary meant to unite the non-Haredi vote.

In a speech to supporters, Bloch said her victory was a source of hope for the entire nation.

“Tonight the people of Israel look to Beit Shemesh and awaken to a new hope,” she said, according to Haaretz. “Beit Shemesh has decided to cancel the walls, to cancel the partitions. Until today, the fringes have been controlling the discourse and preventing us from seeing people.”

A former principal at the city’s Branco-Weiss high school and a mother of four, Bloch, who is religious, has touted herself as able to shrink the divides that have made the city a battleground between the Haredi population and other residents.

“I think I am a bridge for everybody,” she told The Times of Israel in 2013. “For the Haredim, I can work as a bridge, and also for the secular. My entire life, I’ve worked with secular people, and I am part of the religious Zionist movement, and I think I have the opportunity to be a bridge between these worlds.”

Abutbul has at times cut a divisive figure in the city. In 2013, he insiisted his city was free of homosexuals, touting it as “holy and pure.”

The last several years have also seen attacks on women by so-called modesty police, drawing protests and international attention to the city.

In 2011, 8-year-old Naama Margolese was spat on and insulted by Haredi men when walking to her school, at the edge of an ultra-Orthodox neighborhood. Earlier this year a group of women were chased and attacked by a mob of ultra-Orthodox men protesting their clothing, in an incident caught on video.

In December, municipal officials were ordered by the Supreme Court to take down large signs demanding women dress modestly, though members of the ultra-Orthodox community have tried to put them back in place.