Turkish President Recep Tayyip Erdogan claimed victory Sunday in a referendum that would grant him vast new powers as the country’s un­rivaled head of state, strengthening his influence over the judiciary and his authority over the parliament and extending his divisive tenure in office.

Unofficial vote tallies published by the state news agency showed that 51 percent of voters approved a set of constitutional changes that would transform Turkey’s system of government from a parliamentary to a presidential system. The preliminary result, if confirmed, would cap a dramatic ascent for the populist Erdogan, a onetime mayor of Istanbul whose governance, mastery of politics and bare-knuckles approach to adversaries have handed him and his Islamist Justice and Development Party, or AKP, a string of election wins since 2002.

But the narrow margin of victory reflected Turkey’s deepening polarization after a failed coup last summer and the anguished arguments over measures that Erdogan’s critics said firmly entrenched one-man rule. Turkey’s main opposition party quickly contested the result of the vote, claiming that up to 2.5 million ballots were invalid and that some election monitors had been removed from polling stations.

Protests were reported in districts of Istanbul and elsewhere Sunday night against a decision by the election board to accept ballots in envelopes lacking official stamps. Vote tallies indicated the referendum had been defeated in Turkey’s three largest cities.

[How Erdogan has reshaped Turkey, as told by readers]

1 of 31 Full Screen Autoplay Close Skip Ad × See photos of the scene as Turkey votes on a tightly-contested referendum View Photos Turkey’s referendum on expanding the powers of its president will determine the future course of the key NATO member and EU hopeful. Caption The referendum on expanding the powers of its president will determine the future course of the key NATO member and E.U. hopeful. The president claimed victory, but opponents alleged fraud. April17, 2017 Turkish President Recep Tayyip Erdogan is greeted by his supporters as he leaves Esenboga Airport in a bus in Ankara,Turkey. Reuters Buy Photo Wait 1 second to continue.

Speaking to supporters in ­Istanbul late Sunday night, ­Erdogan suggested that criticism of the balloting was “unnecessary,” adding that unofficial tallies showed that 25 million citizens had voted for the measures. “Turkey has spoken its mind,” he said.

The changes, he added, would substantially transform Turkey’s government, something Erdogan’s supporters say is long overdue and necessary for the country’s stability.

“Regardless of whether they cast a yes vote or a no vote,” the president said, “I would like to thank all our citizens.”

The changes put to the people Sunday would allow Erdogan, who came to power as prime minister in 2003, to run for reelection in 2019 and serve two five-year terms — cementing, in the minds of many here, his status as the most consequential leader since Mustafa Kemal Ata­turk, the founder of the Turkish republic.

Ongoing conflicts in the Middle East have made Erdogan a pivotal partner of Western nations in recent years. That is especially true of the United States, which is leading a military coalition to defeat the Islamic State militant group across Turkey’s borders in Iraq and Syria. Turkey also hosts more than 3 million refugees from Syria and has struck a deal with European nations to prevent the refugees from traveling to Europe.

Domestic turmoil, though, has made Turkey an unpredictable ally. A failed coup last summer killed more than 250 people and set off a feverish government purge of its enemies in state institutions — as well as a hunt by Turkey’s government for alleged coup participants who had fled abroad, including to Europe.

Turkey has accused Fethullah Gulen, a Muslim cleric living in exile in the United States, of directing the coup through his vast network of supporters in Turkey. Erdogan’s government has repeatedly requested Gulen’s extradition from the United States, causing friction in the relationship.

(The Washington Post)

Turkey’s rekindled war with Kurdish militants has also stoked tensions with the United States. Erdogan has objected to American support for Syrian Kurdish forces that Turkey regards as an extension of the Kurdistan Workers’ Party, or PKK, which is classified as a terrorist group by Ankara and Washington.

Erdogan’s relatively measured appeal for unity Sunday was in sharp contrast to the tenor of a referendum campaign that saw the government associating its political opponents with terrorists and that further raised tensions with Turkey’s foreign allies.

During the campaign, Erdogan pursued a fight with several European allies, including Germany and the Netherlands. The cause, ostensibly, was a ban on Turkish officials campaigning for votes among Turkish expatriates in Europe. Erdogan used the squabble to maximum effect, deriding German and Dutch leaders as “Nazis” in a series of broadsides that whipped up nationalist support at home.

Terrorist attacks directed at Turkey by Kurdish militants and the Islamic State have kept the country under a state of emergency since the coup. That, along with a crackdown on critical journalists, opposition politicians and other civil society figures, raised questions about whether the referendum could be held under such circumstances.

A leading opposition politician from the pro-Kurdish Peoples Democratic Party, or HDP, was arrested in November, denying the “No” campaign one of its most visible and charismatic voices. As independent media outlets were shuttered or their executives dragged into court, the AKP’s campaign for “Evet,” or “Yes,” dominated Turkey’s airwaves and its public spaces.

“The playing field was never level,” said Semih Idiz, a Turkish political analyst and columnist who writes for the al-Monitor news site. “All the state’s infrastructure and funds went to promote the yes vote,” he said.

The claims of irregularities by opposition parties, along with the split vote, meant “we are going to have a tense period of domestic debate, unless there is some soul-searching on the part of the government and the presidency,” he said.

[Here’s why Turkish opposition parties are contesting the referendum results]

Erdogan’s surrogates have argued that the constitutional changes will make him more accountable, not less. But independent analysts have found that the proposed changes eliminate many constraints on the president’s authority.

A recent report by scholars at the Brookings Institution concluded that “the parliament’s traditional function as a check-and-balance mechanism on the executive would be reduced.” One of the proposed changes “would elevate the president above legislative scrutiny — a major and dramatic break from past practice,” the authors wrote.

Erdogan’s most loyal supporters insisted that the referendum vote went beyond the details of the changes and amounted to a verdict on the president’s record. His coalition included his core constituency of conservative Muslims who have delivered unflinching support to Erdogan over the years, regarding him as a champion of their concerns. He also successfully courted a segment of a Turkish nationalist party whose members helped propel the constitutional amendments through the parliament.

At a polling station in Kasimpasa, the Istanbul neighborhood where Erdogan grew up, Ahmet Yeniad, a 40-year-old auto repairman, said Sunday that the choice of how to vote had been a simple matter for him. The constitution, as it was written, was an “obstacle” to Turkey moving forward, he said. “We are certain about our leader,” he added.

“No” voters cited fear of growing autocracy and the government’s clampdown since the failed coup. In the Kurdish city of Diyarbakir, a focal point of the state’s war with the PKK that is now heavily patrolled by Turkish security forces, Veysi Adenli, 46, said he viewed his decision to reject the referendum as a vote for “peace.”

“I want everyone to be able to share their opinions and political views in this country. We do not want to be thrown in jail,” he said. He was particularly angry, he said, about the arrests of Kurdish politicians, an attack on Turkey’s democracy.

“We elected them,” he said. “We elected them with our free will.”

An employee of The Washington Post reported from Diyarbakir, Turkey.

Read more:

Turkey arrests pro-Kurdish lawmakers as crackdown widens

Handcuffs and hair-pulling: Turkey’s parliament approves new powers for president

Turkish battle over ‘executive presidency’ prompts tensions abroad

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news