Ekrem Imamoglu, the Republican People’s Party candidate for Istanbul mayor, greets supporters before a press conference on April 1. (Erdem Sahin/EPA-EFE)

ISTANBUL — Spring is coming to the shores of the Bosphorus after a long winter.

In local elections across Turkey on Sunday, President Recep Tayyip Erdogan’s Justice and Development Party (AKP) lost all the major cities, including Istanbul and the country’s capital, Ankara. After a divisive campaign in which the opposition candidates were accused of either being terrorists or being backed by terrorists, with threats of imprisonment or removal from office, Erdogan’s AKP also lost the entire Turkish coastline, all but one of Turkey’s major cities, and main Kurdish cities in the east. Despite a repressive atmosphere and relentless media coverage in favor of the AKP, Turkish voters have rallied behind opposition candidates in big cities, sending Erdogan a clear message: Enough is enough.

This is a watershed moment in our political history. Istanbul is the financial hub of Turkey — and Ankara the bureaucratic one. But with its population of 15 million, Istanbul also bankrolls Turkey’s politics. That’s why the final nail-biting battle on Sunday night was for its conquest. As the saying goes, “whoever wins Istanbul wins Turkey.” Since Erdogan’s own ascent to power started with his victory as Istanbul mayor in 1994, the symbolism is not lost on anyone. No matter how you look at it, the takeover by the secularist-led opposition after 25 years of Islamist reign marks the beginning of AKP’s political decline. It could still be years before there is a transition of any sort in Turkey, but Erdogan will not be a lifetime president. He is not invincible.

Mind you, this wasn’t an ordinary campaign. Turkey’s strongman is not only a populist — he has also built an illiberal regime in which he controls much of the judiciary, all of the state institutions, the security agencies and the media. For a month now, building-sized posters of a stern-looking Erdogan saying, “Istanbul is my love,” were draped all over the city. He held as many as eight campaign rallies a day, with networks interrupting their programming to broadcast each and every one. As usual, Erdogan’s campaign theme was war against the enemies of the state: He showed footage of Kurdish politicians, feminists, even of the Christchurch massacre, to paint himself as a crusader against those that want to destroy, split up, weaken Turkey. This “enemies” also include liberals who backed the opposition, the West, Europe, George Soros, Israel, “atheists,” “finance barons,” including JP Morgan, which was targeted by an investigation last month for simply reporting that Turkish central bank reserves were declining. Imagine what a lunacy we live in.

But the opposition took the “go high when they go low” adage to heart. Main opposition secularists (CHP) and the center-right Iyi Party made an official coalition and were backed by supporters of the pro-Kurdish Peoples’ Democratic Party (HDP). Despite Erdogan’s allegations that the opposition had “terrorist-linked” candidates on its party lists, the coalition kept a positive message. The star of the elections was Ekrem Imamoglu, the unassuming candidate for Istanbul mayor, who spoke of uniting the city, embracing all identities, of his plans for a new and green agenda. People were hungry for that tone.

A day before the elections, I briefly lost hope watching one of the opposition leaders, Meral Aksener, campaign in a small Aegean town with a suitcase on stage. Erdogan had been hinting about arresting her, and she had a black suitcase at the podium, saying she is packed and ready to go to jail if necessary. I thought her performance was outstanding but wondered if we, Turkish democrats, were delusional, believing that elections mattered in an authoritarian regime.

It turns out we were not. Despite the overwhelmingly unfair media landscape and a campaign of fear, we still have a one-citizen-one-vote system here. When millions quietly go to the ballots to express dissatisfaction, it makes a difference.

There is a lesson in all of this for democrats around the world struggling under populists or semi-authoritarian regimes. If you are organized, find the right candidate with the right message — there’s your chance. In many parts of the world, illiberal leaders many times succeed in part because opposition parties are too inefficient or divided. What made the difference in Istanbul and Ankara was not only that the opposition parties united for the first time but also that they were organized at the ballots, making sure there was an observer who stayed until the end of counting and got a copy of the signed affidavit.

Erdogan’s AKP might still contest the results, asking for recounts again and again. But as long as the ballots remain sealed, nothing will change. If the AKP insists, it will be a serious erosion of its legitimacy — since Erdogan has always pointed to the ballot box as the ultimate source of political legitimacy — and further sink Turkey.

This is just a local election, and Erdogan will rule Turkey for a long time yet. But unless he hears the message from the voters, what happened in Istanbul on Sunday will happen on a national level at the next general election. For spring is here.

Read more:

David Ignatius: Erdogan sabotages Turkey’s progress by turning away from the West

Asli Aydintasbas and Jeremy Shapiro: The U.S. and Turkey have bigger problems than their erratic leaders

Enes Kanter: Anyone who speaks out against Erdogan is a target. That includes me.

The Post’s View: Erdogan is transforming Turkey into a totalitarian prison

The Post’s View: Trump is right to push Turkey. He’s just doing it wrong.