For around 5 million new voters who have never met any other leader, the election was a chance for change in a country where Erdogan’s AK Party has been in power since 2002. Erdogan, 69, became prime minister the following year and president in 2014.

More than 64 million people, including 3.4 million overseas voters, were eligible to vote and turnout, in a country where it is traditionally strong, was high.

Harun Armağan, a member of the AK Party’s Central Decision-Making Board, said on Sunday night that the results bode well for Erdogan.

“We can clearly see that it is a solid victory for President Erdoğan and the AK Party,” he said. «It is a night of victory for the millions of supporters of the AK Party in Turkey.»

Before the elections, the atmosphere was optimistic in Istanbul.

“I just voted and I’m waiting for the results,” Banu Yilmaz, 60, a retired banker, told NBC News.

Zafer Özi, 81, a retired pharmacist, said: “We hope that this time something can change in our country. Because now I think people are more aware.»

Turkey is still reeling from the aftermath of two massive earthquakes in February, which devastated 11 southern provinces and killed tens of thousands of people.

Erdoğan’s government has been criticized for its response to the disaster, as well as lax implementation of building codes that worsened the misery.

A languishing economy, which critics have accused the government of mismanaging, and a sharp cost-of-living crisis also dominated the agenda, along with a backlash against millions of Syrian refugees, in the run-up to the vote.

Erdoğan increased salaries and pensions and subsidized electricity and gas bills in a bid to appeal to voters while leading a divisive campaign in which he accused the opposition of being «drunks» in cahoots with «terrorists.» He also attacked opponents for standing up for LGBTQ rights, which he said were a threat to traditional family values.

Kılıçdaroğlu, 74, who has led the secular, center-left Republican People’s Party (CHP) since 2010, vowed to reverse Erdogan’s policies and restore democracy.

A markedly different figure from Erdoğan, known for his bombastic speeches, he is soft-spoken and has built a reputation as a bridge builder. During the campaign, he recorded videos in his kitchen in an attempt to speak to voters.

His six-party National Alliance vowed to dismantle the narrowly voted presidential executive system in a 2017 referendum. Since then, Erdogan has centralized power in a 1,000-room palace on the outskirts of Ankara, and it is from there that Formulated Turkey’s policies on economic, security, internal and international affairs.

In addition to returning the country to parliamentary democracy, Kılıçdaroğlu and the alliance vowed to establish the independence of the judiciary and the central bank, institute checks and balances, and reverse democratic rollback and the crackdown on freedom of expression and dissent under Erdogan.

The alliance includes the nationalist Good Party, led by former Interior Minister Meral Akşener, and two parties that broke away from Erdogan’s AK Party and are led by former Prime Minister Ahmet Davutoğlu and former Finance Minister Ali Babacan.

Also running for president was Sinan Oğan, a former academic who is backed by an anti-immigrant nationalist party.

Another candidate, center-left politician Muharrem İnce, dropped out of the race on Thursday after a significant drop in his ratings, but the country’s electoral board deemed his withdrawal invalid and votes in his favor will be counted.

Neyran Elden reported from Istanbul and Henry Austin from London.

Associated Press and denis romero contributed.