By giving Recep Tayyip Erdogan half of their votes this weekend, Turks sent their ambitious prime minister a mixed message: Yes, we love our political stability and prosperity, but no, don’t mess too much with democracy — and don’t turn us into another Iran.

Regrettably, Erdogan is unlikely to hear that message. His power-grabbing maneuvering is likely to accelerate despite Sunday’s election results, which gave his Justice and Development Party (AKP) a decisive parliamentary majority, but didn’t give Erdogan enough power to rewrite Turkey’s constitution unilaterally.

But Erdogan, the most charismatic leader since the Turkish republic’s founder, Mustafa Kemal Ataturk, isn’t one to give up easily.

True, Erdogan told voters Sunday after the vote that he’d now seek “consensus” on rewriting the constitution. But to tailor Turkey to the size of his ambitions, he’s likely to jail more reporters, stack the judiciary with more loyalists and increase business tycoons’ reliance on his favors.

How did the strictly Islamist Erdogan get a mostly easygoing secular society to trust him with so much power? Simple: the economy.

Since the AKP’s first electoral victory, in 2003, Erdogan has liberalized the Turkish economy and made it more market-oriented, turning a backwater country into a financial powerhouse. Under his stewardship, Turkey has weathered Europe’s and America’s economic woes. Last year’s growth clocked in at a whopping 8.9 percent.

At the same time, Erdogan has conducted a populist foreign policy marked by anti-Americanism and Israel-hatred (complete with anti-Semitic overtones).

The first clue was in 2003. Just as the Pentagon finished drawing up its Iraq War strategy, Erdogan blocked all troop movement through his country — a stunning last-minute Turkish reversal. (Regardless of your views on the war, Turkey harmed America by forcing the Bush administration to rewrite much of its invasion plans.)

Erdogan then went full force against Turkey’s closest regional ally of the time — Israel.

His initial assault, in January 2009, was an ugly, emotional and personal attack against dovish President Shimon Peres. By last year, Erdogan was giving his blessing to a flotilla organized by an extremist Turkish Islamist group, IHH, that attempted to run Israel’s Gaza blockade, attacking Israeli soldiers and provoking a deadly response.

That disaster may be repeated next week, when the IHH again plans to challenge Israel, risking a fresh confrontation that would likely put on ice Jerusalem’s already icy relations with Ankara.

Erdogan hasn’t taken any significant step to stop the new flotilla, which even the United Nations Secretary-General Ban Ki-moon considers provocative, from sailing.

Meanwhile, Erdogan also has warmed to Iran. The mullahs compete with his regional leadership, but Erdogan applies to Iran (and several other regional states) the old Vito Corleone maxim: Keep your friends close and your enemies even closer.

Erodgan’s foreign-policy maneuvering (executed faithfully by his alter ego, Foreign Minister Ahmet Davutoglu) is part of an ambitious plan to reshape modern Turkey into its old Ottoman self — if not quite a world-dominating empire, at least a top international arbitrator and leader.

So far, Ankara’s drive has succeeded. In past decades, Europe snubbed Turkey, refusing to admit it as member to its club; now all the Europeans can do is envy the Turkish boom.

But just as some analysts think that Turkey’s economy is overheated and could crash soon, others see dangers in Erdogan’s overreaching foreign policy. Can Turkey ride the tiger of Arab discontent before Arabs turn on Turkey? Will the region adopt the “Turkish model” of Islamic democracy, or will Turkey adopt the worst ways of the region?

President Obama has looked up to Erdogan, seeking his advice more often than any other regional leader. But as some old “friends” have discovered, Erdogan can turn on you quickly. (Just ask Syria’s President Bashar Assad, who was a close Ankara ally until recently; now, Erdogan accuses him of committing “atrocities.”)

Obama’s post-election message to Erdogan should be similar to the one sent by Turkey’s voters: Yes, but. Yes, Washington remains your friend, but America, too, can turn on a dime. If you stray too far by tightening alliances with our regional foes and attacking our allies, we’ll exert our power to slow your rise. Twitter: @bennyavni