There was more than a hint of grovelling in Turkish President Recep Tayyib Erdogan's approach to his new "dear friend", Russian President Vladimir Putin.

First came Erdogan's carefully worded apology in June for ambushing and shooting down a Russian plane on the Syrian border last November. The Turkish economy was reeling under the ban on trade and tourism that Moscow had imposed after that ill-considered outrage, and Erdogan was trying (unsuccessfully, at that point) to get it lifted.

Then came the attempted military coup in Turkey on July 15-16, when the Turkish president realised that he didn't have a friend left in the world apart from Saudi Arabia and Qatar. The US government almost certainly wasn't behind the coup, but it was clear that it wouldn't have minded terribly if Erdogan had been overthrown. Neither would the European Union nor NATO, Turkey's most important alliance.

All the governments of Turkey's Middle Eastern neighbours - Iran, Iraq, and Syria - see Erdogan as an enemy, and so does about half of his own population. (His fiercely pro-religious domestic policies have split Turkey right down the middle.) He is involved in an unwinnable war with Turkey's own Kurdish minority, and the rebels he backed in Syria are losing the war there. This is a man desperately in need of friends.

Erdogan has only himself to blame for his isolation. It was his Sunni religious enthusiasm, not Turkish national interest, that led him to back the Syrian revolt aimed at overthrowing Basharal-Assad, an Alawite (non-Sunni) leader. He kept the Turkish-Syrian border open to supply the Syrian rebels, including Islamic State and the local affiliate of al-Qaeda, thereby alienating the Western countries that are Turkey's main allies.

Last July, he restarted a war against Turkey's big Kurdish minority, breaking a two-year ceasefire in order to appeal to right-wing Turkish nationalists and win a close election. He has also bombed and shelled the Syrian Kurds along Turkey's southern border who are America's most important allies in the ground war against Islamic State. And he deliberately shot down a Russian bomber because Russia was helping Assad survive.

In other words, Erdogan is an impulsive short-term thinker with no grand strategy who has put Turkey and himself in a very difficult position. That's why he had to fly to St Petersburg this week to visit his "dear friend" Putin - who, of course, greeted him with open arms.

HAPPY TO SCORE POINTS

Putin is always happy to score points against the West, and Turkey has NATO's second-biggest army (although half its generals have just been jailed or dishonourably discharged). Restoring trade ties will help Russia, too (although Turkey was hurting much more). But Erdogan was the supplicant here. So what will be the price of his "friendship" with Putin?

First and foremost, it will be an end to Turkish support for the Syrian rebels. No more missiles smuggled across the border from Turkey to shoot down Russian helicopters, and indeed, no more arms, money, or recruits crossing the border at all, particularly for the fanatics of Islamic State and the al-Qaeda affiliate (currently trading as Fateh al-Sham), who are doing most of the fighting against Assad's regime.

At a slightly later date, Erdogan will be expected to downgrade his relations with Saudi Arabia and Qatar, the revolt's main Arab backers, and reopen contacts with the Assad regime. In the long run, Moscow hopes, the result will be a decisive Assad victory in the Syrian civil war. Even a month ago, that seemed improbable, but Turkey is the only route by which money and weapons from the Arab Gulf states can reach the rebels.

INEVITABLE CONCERN

There is inevitably a flutter of concern in Washington about this new 'Turkish-Russian axis', but none of the likely consequences in the Middle East will damage American strategic interests. Washington hawks still insist that the United States can destroy both the extreme Islamists AND the Assad regime, but the realists in the US military and the Obama administration now accept that Assad's survival is the lesser evil.

And the hawks in Washington need not worry about NATO's future: Turkey and Russia are not getting married. They are just getting into bed together for a while until Erdogan feels less threatened.

Turkey's fundamental strategy for the past two centuries, under sultans, elected governments, and occasional military regimes alike, has been to have a powerful foreign ally to counterbalance the permanent threat from the great Russian power to its north.

For the past 52 years, that powerful foreign ally has been the United States, and, by extension, the NATO alliance that America leads. The geopolitical calculations that drew Turkey into that alliance have not changed. Erdogan is not planning to break his country's strategic ties with the US, and the humble pie he is being forced to eat may hasten an end to the killing in Syria.

- Gwynne Dyer is an independent journalist whose articles are published in 45 countries. Email feedback to columns@gleanerjm.com.