ISTANBUL (AP) — Turkish President Recep Tayyip Erdogan was proclaimed the winner early Monday of a landmark election that ushers in a government system granting the president sweeping new powers and which critics say will cement what they call a one-man rule.

The presidential vote and a parliamentary election, both held more than a year early, completed NATO-member Turkey’s transition from a parliamentary system to a presidential one, a process started with a voter referendum last year.

“The nation has entrusted to me the responsibility of the presidency and the executive duty,” Erdogan said in televised remarks from Istanbul after a near-complete count carried by the state-run Anadolu news agency gave him the majority needed to avoid a runoff.

The head of Turkey’s Supreme Election Council, Sadi Guven, declared Erdogan the winner early Monday after 97.7 of votes had been counted. The electoral board plans to announce final official results on June 29.

Based on unofficial results, five parties passed the 10 percent support threshold required for parties to enter parliament, Guven said.

“This election’s victor is democracy, this election’s victory is national will,” Erdogan told a cheering crowd outside his party headquarters in Ankara early Monday, adding that Turkey “will look at its future with so much more trust than it did this morning.”

“Justice has been served!” said Cihan Yigici, one of those in the crowd.

Thousands of jubilant supporters of the pro-Kurdish Peoples’ Democratic Party, or HDP, also spilled into the streets of the predominantly Kurdish southeastern city of Diyarbakir after unofficial results from Anadolu showed the party surpassing the 10 percent threshold and coming in third with 11.5 percent of the parliamentary vote.

The HDP’s performance was a success, particularly considering it campaigned with nine of its lawmakers, including its presidential candidate Selahattin Demirtas, and thousands of party members in jail. It says more than 350 of its election workers have been detained since April 28.

Revelers waved HDP flags and blared car horns. One party supporter, Nejdet Erke, said he had been “waiting for this emotion” since the morning.

Erdogan, 64, insisted the expanded powers of the Turkish presidency will bring prosperity and stability to the country, especially after a failed military coup attempt in 2016. A state of emergency imposed after the coup remains in place.

Some 50,000 people have been arrested and 110,000 civil servants have been fired under the emergency, which opposition lawmakers say Erdogan has used to stifle dissent.

The new system of government abolished the office of prime minister and empowers the president to take over an executive branch and form the government. He will appoint ministers, vice presidents and high-level bureaucrats, issue decrees, prepare the budget and decide on security policies.

The Turkish Parliament will legislate and have the right to ratify or reject the budget. With Erdogan remaining at the helm of his party, a loyal parliamentary majority could reduce checks and balances on his power unless the opposition can wield an effective challenge.

Erdogan’s apparent win comes at a critical time for Turkey. He recently has led a high-stakes foreign affairs gamble, cozying up to Russian President Vladimir Putin with pledges to install a Russian missile defense system in the NATO-member country.

The president’s critics have warned that Erdogan’s re-election would cement his already firm grip on power and embolden a leader they accuse of showing increasingly autocratic tendencies.

According to Anadolu, the near-complete results showed Erdogan winning an outright majority of 52.5 percent, far ahead of the 30.7 percent received by his main challenger, the secular Muharrem Ince.

The HDP’s imprisoned Demirtas was in third place with 8.3 percent according to Anadolu. Demirtas has been jailed pending trial on terrorism-related charges he has called trumped-up and politically motivated.

But Ince said the results carried on Anadolu were not a true reflection of the official vote count by the country’s electoral board. The main opposition party that nominated him for the presidency, the CHP, said it was waiting for the commission’s official announcement.

Erdogan also declared victory for the People’s Alliance, an electoral coalition between his ruling Justice and Development Party and the small Nationalist Movement Party, saying they had a “parliamentary majority” in the 600-member assembly.

The unofficial results for the parliamentary election showed Erdogan’s Justice and Development Party, or AKP, losing its majority, with 293 seats in the 600-seat legislature. However, the small nationalist party the AKP was allied with garnered 49 seats.

“Even though we could not reach out goal in parliament, God willing we will be working to solve that with all our efforts in the People’s Alliance,” Erdogan said.

The president, who has never lost an election and has been in power since 2003, initially as prime minister, had faced a more robust, united opposition than ever before. Opposition candidates had vowed to return Turkey to a parliamentary democracy with strong checks and balances and have decried what they call Erdogan’s “one-man rule.”

Erdogan enjoys considerable support in the conservative and pious heartland, having empowered previously disenfranchised groups. From a modest background himself, he presided over an infrastructure boom that modernized Turkey and lifted many out of poverty while also raising Islam’s profile, for instance by lifting a ban on Islamic headscarves in schools and public offices.

But critics say he became increasingly autocratic and intolerant of dissent. The election campaign was heavily skewed in his favor, with opposition candidates struggling to get their speeches aired on television in a country where Erdogan directly or indirectly controls most of the media.

Ince, a 54-year-old former physics teacher, was backed by the center-left opposition Republican People’s Party, or CHP. He wooed crowds with an unexpectedly engaging campaign, drawing massive numbers at his rallies in Turkey’s three main cities of Istanbul, Ankara and Izmir.

More than 59 million Turkish citizens, including 3 million expatriates, were eligible to vote.