Turkish Prime Minister Recep Tayyip Erdogan has won the presidential election in Turkey's first direct presidential election on Sunday, extending his 12-year grip on power. Despite heavy campaigning and the financial support from public funds, he won the election with only 51.95 percent of the vote, slightly higher than the minimum required to win the election.

For Erdogan, the real work has just begun. Sunday’s results are only the first step in his pledge to beef up the largely ceremonial presidency and transform the parliamentary system into a US-like presidential one. Switching to a presidential system requires a constitutional change. To change the constitution, Erdogan will need the support of two thirds of the members in the parliament and a majority win for the AKP in the June 2015 parliamentary elections to pass the constitutional amendments. This is where things get challenging for Erdogan.

In the interim period ahead of the parliamentary elections, Erdogan has to manage the party carefully to prevent a power struggle within the party. He needs a loyalist prime minister who is strong enough to keep the unity of the party and increase its votes in 2015 but compliant enough to go along with Erdogan’s political ambitions. Whoever Erdogan appoints as the prime minister will prove critical to his executive presidential drive.

Under the constitution, Erdogan has to resign from the party after his inauguration on August 28. A grand party congress will elect the new party leader, who will then be appointed as the new prime minister by Erdogan.

Erdogan’s struggle to establish a presidential system does not end there. The AKP now holds 58 percent of parliament seats. The new prime minister has to increase the party’s seats in 2015 elections and secure a two-thirds majority in parliament to pass the constitutional amendments, which then will be put to referendum. This is a tall order even for Erdogan.

Erdogan’s significant but narrow win on Sunday is a testament to the challenges ahead for his presidential ambitions. Turkish society remains deeply divided over Erdogan’s rule. In the last year, he has faced several challenges that have undermined his popularity.  A recent Pew Research Center survey portrayed Turkey as a divided society, with 48 percent approving of Mr. Erdogan and 48 percent disapproving. Many in Turkey's opposition feel excluded from politics, which explains the 72.2 percent turnout on Sunday - the lowest participation in a national election since 1977 and far below the 90 percent levels for local elections in March. Mass anti-AKP protests in 2013 were suppressed by police forces and have created a perception of Erdogan as an increasingly authoritarian leader. A corruption scandal that included his inner circle and the fall-out with his former ally Fethullah Gulen, a U.S.-based imam, only added to this image problem.

And the party’s biggest test is yet to come. The AKP has to widen its base ahead of parliamentary elections, and with Erdogan officially resigned from the party, it’s not clear how well the party can do. A reshuffling within the AKP might further weaken the party. The AKP’s charter does not allow party members to hold elected posts more than three times, which means 70 members of the AKP, who are key figures within the party, cannot run for the elections in 2015.

Erdogan’s quest to trade up from parliamentary to a presidential system will not be a smooth ride. But he can still enjoy wide executive powers without a constitutional change. The current constitution allows the President to chair Cabinet meetings, issue governmental decrees, veto laws, determine the internal rules of the national parliament and call early elections.  He has the power to appoint the head of the general military staff, the board of higher education as well as university presidents, members of the Constitutional Court, and the Supreme Board of Judges and Prosecutors.

Turkish presidents have refrained from exercising these executive powers. But Erdogan will not be one of them. Erdogan and his supporters will argue that as the first popularly elected president, he has the mandate to play a more active role as the chief executive of the country. Throughout his presidential campaign, he hinted that he would use “the full extent of his constitutional powers” to be an “active president.”

Whether Erdogan will be able to realize his dream of turning Turkey into a presidential system remains to be seen. What is certain is that his presidency will be unlike any of his predecessors.