ANKARA/ISTANBUL, April 17 (Reuters) - Supporters of Tayyip Erdogan waved flags in the streets while opponents banged pots and pans in protest in their homes, after a narrow referendum victory gave the Turkish president sweeping powers and laid the nation’s divisions bare.

The referendum will bring the biggest overhaul in Turkish politics since the founding of the modern republic, abolishing the post of prime minister and concentrating power in the hands of the president. Unofficial results, which the opposition said it would challenge, showed a narrow victory with 51.4 percent of votes cast in favor.

Yet the procedures used in both the campaign leading up to the referendum as well as on the day of didn’t adhere to international standards and created an “unlevel playing field,” Tana de Zulueta, head of the team of Organization for Security and Co-operation in Europe observers present in Turkey, said in a news conference Monday.

She noted issues in the process including an absence of civil society observers in many polling stations; police intimation of some “No” sympathizers; a lack of impartial information about both side of the campaign and the fact that the referendum question wasn’t even listed on the ballot.

Erdogan, a populist with a background in once-banned Islamist parties, has ruled since 2003 with no real rival, while his country emerged as one of the fastest-growing industrial powers in both Europe and the Middle East.

He has also been at the center of global affairs, commanding NATO’s second biggest military on the border of Middle East war zones, taking in millions of Syrian refugees and controlling their further flow into Europe.

Erdogan survived a coup attempt last year and responded with a crackdown, jailing 47,000 people and sacking or suspending more than 120,000 from government jobs such as schoolteachers, soldiers, police, judges or other professionals.

The changes could keep him in power until 2029 or beyond, making him easily the most important figure in Turkish history since state founder Kemal Ataturk built a modern nation from the ashes of the Ottoman empire after World War One.

In a signal of the direction he now plans for his nation, Erdogan said he would call a referendum to restore the death penalty, ending once and for all Turkey’s decades-long bid to join the European Union, the impetus for years of reforms.

KEMAL ASLAN / Reuters People protest against the results of the referendum in Istanbul, Turkey April 16, 2017.

CHRONIC INSTABILITY

Erdogan has long said the changes to the constitution were needed to end the chronic instability that plagued the country over decades when the military repeatedly tried to seize power from weak civilian governments.

“For the first time in the history of the Republic, we are changing our ruling system through civil politics,” he said in a victory speech.

But the narrow referendum result could itself be a sign of more instability to come. The changes won strong backing in conservative rural areas, but were strongly opposed in Istanbul and other cities, as well as in the restive Kurdish southeast.

Thousands of supporters waved flags and blasted horns into the early hours on Monday in celebration of a man who they say has transformed the quality of life for millions of pious Turks marginalized for decades by the secular elite.

There were scattered protests against the result, but these were more sporadic. In some affluent, secular neighborhoods, opponents stayed indoors, banging pots and pans, a sign of dissent that became widespread during anti-Erdogan protests in 2013, when the police crushed demonstrations against him.

The main opposition said the vote was marred by irregularities and it would challenge the result.

“The referendum is won but it is no victory. The results did not yield a meaningful ‘Yes’,” Abdulkadir Selvi, a pro-government columnist wrote in the Hurriyet newspaper.

The High Electoral Board (YSK) confirmed late on Sunday the results had shown the “Yes” campaign with 1.25 million more votes than the “No” camp. The official results are expected within 12 days.

The main opposition Republican People’s Party (CHP) demanded a recount of up to 60 percent of the votes. It cited a last minute decision by the electoral board to count ballots that had not been stamped by officials as a potential irregularity.

Erdogan said 25 million people had supported the proposal, which will replace Turkey’s parliamentary system with an all-powerful presidency. That was a smaller margin of victory than the decisive result for which he and his ruling AK Party had aggressively campaigned.

Nevertheless, by ending uncertainty the result triggered a two percent rally in the Turkish lira from its close last week. It traded at 3.6380 against the U.S. dollar early on Monday, firming from 3.7220 on Friday.

Murad Sezer / Reuters Supporters of Turkish President Tayyip Erdogan celebrate in Istanbul, Turkey, April 16, 2017.

'NO EARLY ELECTIONS’

Under the changes, most of which will only come into effect after the next elections due in 2019, the president will appoint the cabinet and an undefined number of vice-presidents, and be able to select and remove senior civil servants without parliamentary approval.

There has been some speculation that Erdogan could call new elections so that his new powers could take effect right away. However, Deputy Prime Minister Mehmet Simsek told Reuters there was no such plan, and the elections would still be held in 2019.

“Yesterday the president made it very clear that elections will be held in November 2019,” he said. “It is very clear. We have work to do.”

Erdogan served as prime minister from 2003 until 2014, when rules were changed to hold direct elections for the office of president, previously a ceremonial role elected by parliament. Since becoming the first directly elected president, he has set about making the post more important, like the executive presidencies of France, Russia or the United States.

In a sign of his authority, he was set to chair a cabinet meeting later on Monday, a role traditionally carried out by the prime minister although he has chaired such meetings before.

Pro-government media painted the result as a victory for the Turkish people, transforming a constitution left over from a 1980 military coup. The Sabah daily hailed “The People’s Revolution.” The Star’s headline was “The People’s Victory.”

However, the opposition daily Cumhuriyet’s headline said “The ballot box is overshadowed,” reporting opposition objections to what they said were irregularities in the voting.

European politicians who have had increasingly strained relations with Turkey, expressed concern about the divisions revealed by the narrow victory margin.

Chancellor Angela Merkel and Foreign Minister Sigmar Gabriel of Germany, where an estimated 4 million Turks form one of the largest minorities from a single country in Europe, said in a statement that Berlin respected the right of Turks to change their country’s constitution.

But they added: “The tight referendum result shows how deeply divided Turkish society is, and that means a big responsibility for the Turkish leadership and for President Erdogan personally.”

The European Commission, the executive body of the European Union, said the close result meant that Ankara should seek “the broadest national consensus” in implementing the vote.

Relations came under strain during the referendum campaign when EU countries including Germany and the Netherlands barred Turkish ministers from holding rallies to support the changes. Erdogan provoked a stern German response by comparing those limits on campaigning to the actions of the Nazis.

(Reporting by Reuters bureaux in Istanbul and Ankara; Writing by Daren Butler, David Dolan and Peter Graff, editing by Peter Millership)