Umit Bektas/Reuters

ISTANBUL — In a swift and brutal exercise that some are calling a “palace coup,” Turkey’s President Recep Tayyip Erdogan has sacked his prime minister to further cement his own power at the helm of the only Muslim NATO country.

Following a meeting between Erdogan and Ahmet Davutoglu late Wednesday, news reports said that the ruling Justice and Development Party (AKP) would hold an extraordinary party congress later this month and that Davutoglu, who has been party leader for nearly two years, would not run for the post of chairman. The AKP has always combined the posts of party chairman and prime minister.

Some reports suggested Erdogan got rid of Davutoglu after the prime minister secured a face-to-face meeting with President Barack Obama in Washington during a visit scheduled for this month. The trip has now been canceled.

“Davutoglu on his way out,” the headline of the Sozcu newspaper blared on Thursday. The crisis spooked markets, with share prices sliding and the Turkish Lira weakening considerably against the dollar.

Davutoglu’s ouster underlines that Erdogan, who has made headlines with his criticism of the West and his clampdown on dissent, no longer faces any real competition in shaping Turkey’s course. “As of today, Turkey has de facto changed to a presidential system,” columnist Murat Yetkin wrote in the Hurriyet daily on Thursday. “As long as Erdogan is president, it will not be important who the prime minister is.”

Even though he quit as AKP leader and prime minister to assent to the nominally nonpartisan presidency in 2014, Erdogan, 62, has remained the most influential man for the party and the government, despite handing both offices to Davutoglu. A 57-year-old former professor and foreign minister without a strong group of followers of his own, Davutoglu worked under Erdogan knowing that the “Tall Man,” a nickname for 6-foot Erdogan, was calling the shots.

But efforts by Davutoglu to strengthen his own role led to tensions between the two men that came to a head in recent weeks. Davutoglu called Erdogan a “legendary leader” but said he himself was the “new leader” of the party.

Davutoglu was also known for his lack of enthusiasm about Erdogan’s master plan to create a U.S.-style presidential system by changing Turkey’s constitution. Critics say the system change envisioned by Erdogan would free the Turkish president of checks and balances that are in place in the U.S. and other countries. Davutoglu was reluctant to push for the presidential system while paying lip service to the plan in public.

That kind of resistance led to Davutoglu’s downfall, analysts say. “The Great Leader demands a hundred percent obedient PM,” Mustafa Akyol, a Turkish author, wrote on Twitter.

Relations between president and prime minister became toxic. Erdogan publicly dismissed as a mere “detail” Davutoglu’s achievement of convincing the EU to grant visa-free travel for Turks starting next month. Through his supporters in the AKP leadership he restricted Davutoglu’s powers as party chief. In a speech shortly before his meeting with Davutoglu on Wednesday, the president said elected officials should never forget how they got their jobs, a clear reference to Davutoglu’s career under Erdogan’s patronage.

In the end, the soft-spoken intellectual Davutoglu was no match for the political street fighter Erdogan, who is revered by the AKP grass roots as a hero. Several Turkish media said Davutoglu had been sidelined in a “palace coup.” Others used the term “Pelican coup” because signs of tension between Erdogan and Davutoglu included an anonymous blog post called “Pelican Brief” that was reportedly written by a pro-Erdogan journalist last week and that called for Davutoglu’s dismissal.

While Erdogan has not named a successor to Davutoglu yet, media reports said there were several AKP officials in the running. One name stuck out: that of Berat Albayrak, 38, the current Energy Minister and Erdogan’s son in-law. Married to Erdogan’s daughter Esra, Albayrak became a minister only last year. Some observers say he is being groomed for a leadership post by Erdogan.

As Davutoglu is packing his bags, foreign leaders will be wondering whether Turkey’s relations with the West will change in the new era. Erdogan’s most recent visit to Washington was a frosty affair. The Turkish leader said he felt betrayed by Obama’s critical words about Ankara’s pressure on the media that has recently widened to foreign reporters in Turkey.

Also, Davutoglu is credited with negotiating a deal with the European Union in March that has led to a drastic drop in the number of migrants crossing from Turkey to Greece. According to UN figures, the daily number of migrants arriving in Greece has fallen to an average of 59 in the first days of May, after 115 a day in April and almost 900 in March. The official Turkish news agency Anadolu says no migrant drowned in the Aegean in April, the first time in many months that no deaths were reported.

In stark contrast to Davutoglu, who has praised the deal with the EU, Erdogan has been critical of the Europeans. Carl Bildt, a former Swedish Foreign Minister, says Europe cannot be sure whether a new Turkish government would continue Davutoglu’s line. “The credibility of Turkey’s EU road rests today with PM (Davutoglu),” Bildt tweeted. “If he leaves, bets are off.”