President of Turkey Tayyip Erdogan (L) and his wife Emine Erdogan (R) greet the crowd from the balcony of the ruling AK Party's headquarters as fireworks illuminate the sky following his election success in presidential and parliamentary elections in Ankara, Turkey on June 25, 2018.

President Recep Tayyip Erdogan won Turkey's landmark election Sunday, the country's electoral commission said, ushering in a new system granting the president sweeping new powers which critics say will cement what they call a one-man rule.

The presidential and parliamentary elections, held more than a year early, complete NATO-member Turkey's transition from a parliamentary system of government to a presidential one in a process started with a 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.

Speaking early Monday, Supreme Election Council head Sadi Guven said 97.7 of votes had been counted and declared Erdogan the winner.

Guven said that based on unofficial results, five parties passed the threshold of 10 percent of votes required for parties to enter parliament.

Cheering Erdogan supporters waving Turkish flags gathered outside the president's official residence in Istanbul, chanting, "Here's the president, here's the commander."

"Justice has been served!" said Cihan Yigici, an Erdogan supporter 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 coming in third with 11.5 percent of the legislative vote -- surpassing the 10 percent threshold needed to enter parliament.

The HDP's performance was a particular success since presidential candidate Selahattin Demirtas, eight more of its lawmakers and thousands of party members campaigned from jails and prisons. HDP says more than 350 of its election workers have been detained since April 28.

The imprisoned Demirtas, who has been jailed pending trial on terrorism-related charges he has called trumped-up and politically motivated, was in third place in the presidential race with 8.3 percent of the vote, according to Anadolu.

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

Erdogan 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.

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.

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.

Ince said the results carried on Anadolu misrepresented 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 an official announcement from the country's electoral board.

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 secured 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 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."

A combative president, 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 has become 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.