In a major blow to Turkish President Recep Tayyip Erdogan, the Turkish opposition has won the mayoral elections in Istanbul.

Erdogan's preferred candidate, former Prime Minister and fellow Justice and Development Party (AKP) member Binali Yilderim, only won 45.1% of the vote to opposition candidate Ekrem Imamoglu's 54%.

During the campaign, Imamoglu's posters featured a slogan in Turkish saying "Everything will be ok," signaling a message of hope for the Turkish electorate.

Yilderim congratulated Imamoglu after the election, saying "we will try to support him in every work he will do on behalf of Istanbulites."

This is the second time these elections were held, as in March the AKP just lost slightly to the opposition. The Turkish election board had canceled that vote and ordered the election be held again due to "irregularities".

For Turkish President Recep Tayyip Erdogan, his party's loss of Turkey's most populated city could be a sign of his political descent. Erdogan's party and his political platform remain highly controversial in Turkey and have divided the country.

In April 2018, the Turkish people voted in a referendum that would expand Erdogan's power as the President of Turkey. A Council of Europe Observer Mission said that 2.5 million votes in the referendum could have been manipulated.

In 2016, there was a coup d'etat staged by a faction of the Turkish armed forces against Erdogan. Erdogan remained in power and blamed the Gulen social movement for the attempted coup. Since then, Erdogan has cracked down on military generals, journalists, lawyers, teachers, human rights activists and writers who his government blames for anti-state activities.

Although Turkey once aspired to join the European Union (EU), the policies of Erdogan and his socially conservative party means his country does not meet the human rights standards to join the bloc.