Turkish President Recep Tayyip Erdogan has narrowly won a historic referendum that will tighten his grip on power, but the knife-edge result left the country bitterly divided and the opposition crying foul.
The sweeping constitutional changes approved in the vote create a presidential system that will grant Erdogan more power than any leader since modern Turkey's founder Mustafa Kemal Ataturk and his successor Ismet Inonu.
The result could also have even wider implications for Turkey which joined NATO in 1952 and for the last half-century has set its sights on joining the European Union.
The 'Yes' campaign won 51.4 per cent of the vote against 48.6 per cent for 'No', the election commission said yesterday in figures quoted by state news agency Anadolu, in a count based on 99.5 per cent of the ballot boxes.
As huge crowds of flag-waving supporters celebrated on the streets, Erdogan praised Turkey for taking a "historic decision".
"With the people, we have realised the most important reform in our history," he added.
Supreme Election Board chief Sadi Guven confirmed that the 'Yes' camp had emerged victorious, but the opposition has vowed to challenge the outcome.
The referendum was held under a state of emergency that has seen 47,000 people arrested in an unprecedented crackdown after the failed military putsch against Erdogan in July last year.
In a nail-biting end to a frenetic campaign, the 'No' share of the vote climbed as more ballots were counted, after lagging well behind in the early count, but failed to overtake the 'Yes'.
"This is a decision made by the people. In our democracy's history, a new page has opened," said Prime Minister Binali Yildirim, whose job will disappear under the constitutional changes.
In a television interview on Friday Erdogan had predicted a far clearer victory saying polls showed a 55-60 per cent share of the vote.
But voting patterns showed Turkey deeply divided over the changes, with the 'No' vote victorious in the country's three biggest cities.
The 'Yes' vote held up strongly in Erdogan's Anatolian heartland but the Aegean and Mediterranean coastal regions and Kurdish-dominated southeast backed the 'No' camp.
In a major disappointment for the president, the 'No' vote was just ahead in his hometown of Istanbul and in the capital Ankara and clearly ahead in the third city of Izmir.
A statement issued by European Commission head Jean- Claude Juncker and EU foreign affairs chief Federica Mogherini said that in view of the closeness of the result, the Turkish authorities need to seek the "broadest possible national consensus" for the changes.
Erdogan made relations with the EU a key issue in his referendum campaign, lambasting Brussels for failing to make progress on Ankara's stalled accession talks and he accused Germany and the Netherlands of acting like the Nazis when they barred pro-government rallies.
Turkey's two main opposition parties said they would challenge the results over alleged violations.
The pro-Kurdish Peoples' Democratic Party (HDP) said it would challenge two-thirds of the votes, saying: "There is an indication of a 3-4 percentage point manipulation of the vote."
Republican People's Party (CHP) chief Kemal Kilicdaroglu said the actions of the election authorities "caused the referendum's legitimacy to be questioned".
"Believe me, this election is not over," deputy CHP leader Erdal Aksunger told CNN Turk, quoted by the Dogan news agency. "This is totally invalid. We are declaring this here."
The opposition had already complained that the referendum has been conducted on unfair terms, with 'Yes' posters ubiquitous on the streets and opposition voices squeezed from the media.
Supporters see the change as an essential modernisation step for Turkey that will remove the risk of the political chaos that blighted the 1990s and is blamed for the 2000-2001 financial crisis.
Opponents fear it risks granting Erdogan authoritarian powers and allow him to ride roughshod over key institutions like the judiciary and parliament.
Closely watched today will be the initial assessment of the international observer mission of the OSCE Office for Democratic Institutions and Human Rights (ODIHR) and the Parliamentary Assembly of the Council of Europe (PACE).
Erdogan again warned Brussels he would sign any bill agreed by parliament to reinstate capital punishment, a move that would automatically end Turkey's EU bid.
If the opposition failed to support the bill, Erdogan said another referendum could be held on reinstating the death penalty.
Western reactions to the referendum will be crucial after Erdogan accused Turkey's allies of failing to show sufficient solidarity in the wake of the failed coup.
"We would like other countries and institutions to show respect to the decision of the nation," Erdogan said.
The new system would dispense with the office of prime minister and centralise the entire executive bureaucracy under the president, giving Erdogan the direct power to appoint ministers.
It is due to come into force after elections in November 2019. Erdogan, who became president in 2014 after serving as premier from 2003, could then seek two more five-year terms.
"I don't think he (Erdogan) will reverse course. I don't think Erdogan will change the robust and muscular approach to politics that he has adopted so far," said Fadi Hakura, Turkey expert at London-based Chatham House think tank.