(CNN)The Turkish people on Sunday voted in favor of changing their constitution, granting the president new far-reaching powers.
Turkey referendum: What happened and what comes next
Voters were asked to either accept or reject an 18-article constitutional reform package put forward by the ruling Justice and Development Party (AKP) that would transform Turkey's parliamentary system into a powerful executive presidency.
With nearly all of the 47.5 millions votes counted, the "Yes" camp claimed a narrow victory with 51.4% of the vote, according to state-run media, a result that punctuates the country's deep divisions.
The results have done little to relieve the tensions in divided Turkey. The opposition has cried foul and is demanding a recount of at least 37% of the votes. "No" campaigners claimed they have faced intimidation and threats of violence, while independent monitors say state media slanted coverage in favor of the president.
Turkey referendum: Related content
The referendum was widely seen as a plebiscite on President Recep Tayyip Erdogan, who has led his country through more than a decade of economic growth and development, first as prime minister and then as president.
Many "No" voters saw the referendum as a power-hungry leader's attempt to cement his position. But "Yes" voters are singing Erdogan's praises, saying they believed Turkey's future would be safer and more prosperous with him at the helm.
The changes limit any one president to two terms, although under certain circumstances they could seek a third. The revision means Erdogan could hit the reset button on his tenure, potentially winning the next two elections and serving until 2029.
No -- according to international monitors, who slammed the referendum as an "unlevel playing field."
Tana de Zulueta, head of the OSCE Office for Democratic Institutions and Human Rights, delivered a scathing monitors' report of the referendum, saying that the "No" campaign had been restricted and that media coverage imbalanced, and that the electoral authority unfairly changed the rules after polls had opened.
She confirmed that the authority decided to accept ballots without official stamps late in the day, adding that it "significantly changed the ballot validity criteria, undermining an important safeguard and contradicting the law."
The stamps were required to avoid "ballot-stuffing" -- where extra votes are cast illegally to manipulate results.
She said that the president and ruling AKP were given preferential treatment in the media and more air time, and that the jailing of journalists and closure of media organizations after the attempted coup last year had "led to widespread self-censorship in Turkey."
She said that the technical aspects of the referendum were, however, generally well administered.
The role of president in Turkey is at the moment largely ceremonial -- it is the prime minister who is the official head of government. But the changes will see the post of prime minister abolished, and most of those powers will be handed to the president.
Erdogan served as prime minister from 2003 until he was elected president in 2014. He has radically changed the post in that time, using his popularity with the Turkish people to remain the de facto head of government and dwarfing the prime minister's role.
The president today is supposed to be impartial and not have ties to a political party, but the new constitution would do away with that rule and allow Erdogan to reinstate himself as the head of the AKP.
Bypassing parliament and the cabinet
The president will assume the cabinet's responsibility for publishing decrees. These decrees mean the president can bypass parliament to form and regulate ministries, and to appoint and remove senior civil servants.
But there are some limitations -- the president cannot issue decrees regarding human rights or basic freedoms, and they cannot override existing laws. It will be up to the courts to decide whether a decree is legally valid.
The president can also draft the state budget, a task normally carried out by parliament, and can declare a state of emergency without cabinet's approval. Since a failed military coup in July last year, Erdogan has had the country's state of emergency status extended several times, which has already given him a taste of expanded powers.
The president could also in some circumstances dissolve parliament, although this would also mean calling an early presidential election.
Twelve of the Constitutional Court's 15 judges will be handpicked by the president. This is particularly important because the Constitutional Court is the only authority that can try the president if parliament should vote to open an investigation into the leader. At the moment, the president appoints 14 of 17, but they are first nominated by plenary assemblies from the country's courts.
The Supreme Court will also change -- there are currently 22 Supreme Court members, four of whom are appointed by the president. Under the new rules, the number of members will reduce to 13, five of whom the president will appoint.
The changes to Turkey's system will be phasal, but it is unclear exactly what will happen when.
Many of them will have to wait until the next presidential election in 2019, when the prime minister's post will cease to exist and most of those powers will be shifted to the president.
One change more likely to be immediate is Erdogan returning as head of the AKP, which Erdogan founded in 2001 and has ruled Turkey since its first election in 2002.
The opposition Republican People's Party (CHP) has questioned the legitimacy of the results and has complained of the last-minute change of rules over the ballot stamps.
The opposition said the change would have affected the results and called for a partial recount of at least 37% of the votes, said Erdal Aksunger of the CHP.
The party will have three days to raise any objections with the electoral board. The board will release its official results in 12 days' time, it has indicated.
If the opposition is not happy with the board's response to its objections, it can then file an appeal to the Constitutional Court. The CHP has said it is also willing to file a case with the European Court of Human Rights if necessary.
One of Turkey's most strategic relationships is with Europe. The country has long been celebrated as a Muslim-majority country with a moderate secular political system, bridging the west with the Islamic east.
This political system has allowed Turkey to launch a bid for European Union membership. But membership talks over decades have been painfully slow, largely because Turkey has failed to comply with a list of EU standards.
Progress has been so slow as of late that it appears Turkey may have given up on joining the bloc.
Erodgan has repeatedly said he will seek to reintroduce the death penalty -- a move that would automatically scupper Turkey's EU bid. He first raised the possibility following the attempted coup last year, implying he would seek to have the perpetrators executed.
Ankara has locked horns with EU leaders over a migrant deal to stem the flow of refugees leaving its shores for EU nations, complaining that Turkey is doing more than its part for refugees but getting nothing in return. It has been lobbying for years to obtain visa-free travel for Turkish citizens traveling to Europe.
Turkey is sheltering around 3 million refugees as little progress is made on the Syrian crisis on its doorsteps.
If Turkey makes clear it no longer cares to join the EU, the migrant deal may come to an end. Turkey may decide to turn inward, or turn away from the West and look for new allies in the east.