CAIRO/ TUNIS Two years ago, Tayyip Erdogan was mobbed by adoring crowds in Arab capitals and Turkey seemed set to expand its trade and influence across the region on the back of his support for the upstart democrats of the Arab Spring.
Today, his crackdown on protests at home has sickened some of those who hailed an unlikely liberator from the land of their former Ottoman overlords; they now scorn the prime minister as little better than the dictators they ousted.
Yet Erdogan still has many Arab fans; his popularity has divided just as the coalitions that overthrew leaders in Egypt, Tunisia and Libya have split into feuding camps. And with fellow Islamists in the ascendant, the Turkish leader can still count on a warm welcome, even if headline writers no longer greet him as the "rock star" of the Middle East or "king of the Arabs".
In Tunisia, cradle of the regional uprisings, Erdogan was received by its Islamist government last week while Turkish police fought protesters on the streets of Istanbul. But there was little of the enthusiasm among Tunisians that greeted him in 2011 as the model for combining Islam, democracy and prosperity.
"Erdogan was just a flash in the pan," said Haykel Jbeli, a young subway train driver in Tunis. "After he talked so much about human rights, the events on Taksim Square have unmasked his true face. He's a hypocrite. He'll never be a model for us."
In Cairo, where liberals fear President Mohamed Mursi will impose Islamic laws favored by his Muslim Brotherhood, activist Khaled Dawoud said Erdogan's derision toward secular Turks and use of force on the streets had turned many Egyptians against a man hailed as a hero on Tahrir Square in 2011, when he was among the first world leaders to tell Hosni Mubarak his time was up.
"We no longer see him as the moderate Islamist who wants to continue with the existing model of democracy," said Dawoud, who took part in protests this week against Islamist control of Egypt's Culture Ministry. "The people see Erdogan right now as a supporter of the Muslim Brotherhood.
"There's a sense that we're facing similar attempts to rebuild dictatorship in the name of religion, whether in Egypt or in Tunisia and of course right now we can see it in Turkey."
For Hamma Hammami of Tunisia's secular Popular Front, "Erdogan is a dictator" like the ousted Zine El Abidine Ben Ali: "He's no different from the leaders in Egypt and Tunisia."
ERDOGAN HAS RIGHT
Nine months ago, a Pew survey of Arab public opinion found Erdogan to be the most popular leader, outscoring King Abdullah of Saudi Arabia who has special status as guardian of the holy city of Mecca. And many Arabs still hold him in high regard.
In Benghazi, seat of the Libyan revolt that toppled Muammar Gaddafi and now beset by factional fighting, student Ali Mohammed, 25, said: "Erdogan has the right to try to stop demonstrations.
"Turkey's economy is being hurt, tourism is affected, so if the government feels this is in danger, they have the right."
While 27-year-old accountant Adil al-Drissi said, "It is wrong," and that the protests could spell the end of Erdogan's rule, engineer Ahmed Musa, 31, reflected the admiration Libyans have for Turkey's economic success story under him:
"Erdogan has done a lot for Turkey and those calling for him to step down are crazy," he said. "Why do they want this?"
In Tunis, Monem Layouni, whose bushy beard is a mark of his Islamist views, praised how the Turkish leader had clashed with Ankara's historic regional ally Israel. He said: "Erdogan is an example, who made his country a model for democracy and Islam."
Another former friend who has felt Erdogan's wrath is President Bashar al-Assad of Syria, and the Turkish leader remains popular with the rebels still fighting in what has turned into by far the bloodiest of the Arab uprisings.
Leena al-Shami, a prominent activist who fled Damascus for Istanbul just a few weeks ago, objected to comparisons Turkish liberals have drawn between their own struggle on Taksim Square and those of Arabs living under authoritarian rule:
"Seeing at first hand the police firing water cannon at the demonstrators on Taksim, giving them relief from the summer heat, and seeing them go and party at night, I couldn't stop myself smiling," she said. "If that was the Assad regime, its forces would have killed hundreds, if not thousands on Taksim."
She worried that, having opened Turkey to Syrian refugees, Erdogan could be forced from office, exposing them to hostility: "We are beginning to fear there could be a backlash against the Syrian refugees if Erdogan is forced to step aside," she said.
Khalid al-Dakhil, a Saudi political sociologist who has studied Turkey's regional strategy, said the unrest at home may hamper Erdogan's hopes of playing a major role in a post-Assad Syria - hopes, he said, that have already been dented by the reluctance of Arab and Western powers to fully back the rebels.
But while Erdogan might be distracted and had lost the "aura of immunity" from opposition that he enjoyed, Dakhil thought it unlikely the protests would cost him power altogether.
OPPORTUNITIES AND RISKS
In any event, there is little evidence that troubles at home, or the poor opinion of disenchanted Arab liberals, will deter Ankara from expanding its economic and diplomatic presence in its old Ottoman backyard, a move that has accompanied a cooling of its long efforts to join the European Union.
In Tunis, where Erdogan and dozens of Turkish business leaders agreed a range of investment deals last week, commentator Amel Belhadj Ali denounced a new "colonization" of North Africa. She asked: "Do we risk becoming an Ottoman dependency again?"
One risk to Erdogan's strategy of influence in the new Arab democracies may come if his Islamist allies suffer a backlash.
Hassan Nafaa, professor of political science at Cairo University and a critic of the Muslim Brotherhood, said the crackdown on dissent in Turkey had turned Egypt's non-Islamists against Erdogan, making the success of Ankara's present Egyptian policy dependent in turn on the success of Egypt's Brotherhood.
"If the Muslim Brothers ... come up with a solid system and bring stability, maybe this will bring the ambitions of the Turkish government closer," Nafaa said. "But if the Muslim Brothers lose, they will lose at the same time."
(Additional reporting by Khaled Yacoub Oweis in Amman and Feras Bosalum in Benghazi; Writing by Alastair Macdonald; Editing by Robin Pomeroy)