Recep tayyip erdogan, who has led turkey for more than 17 years, is known for being pragmatic as well as pugnacious.

Thus, amidescalating tensions in the eastern mediterraneanover territorial boundaries and maritime gas deposits, turkey has withdrawn an exploration vessel and agreed to reopentalks with greece, its fellow nato member and old aegean rival. all this just before this weeks eu summit, which a top adviser to mr erdogan says is the chance for a turkishreset with europe.

Yet he appears simultaneously to be leaping into another conflict a lethalflare-upof the simmering dispute between armenia and azerbaijan over the separatist enclave ofnagorno-karabakh. that could bring him into yet another stand-off with his sometime friend and fellow strongman, russian president vladimir putin.

To recap: turkey and russia are on opposing sides in the civil wars in syria and libya and yet they try to collaborate in their attempts to manage these conflicts to their mutual advantage.

Mr erdogan strongly supported the mainly sunni rebellion against bashar al-assad in syria from 2011. back then, he was a more overtly neo-islamist figure, expecting forces allied to the muslim brotherhood to sweep all before them in a series of arab upheavals. mr putin salvaged the assad regime, committing russias air force to syria in 2015, alongside iranian revolutionary guards and their proxy militia on the ground.

When, in the summer of 2016, mr erdogan put down an attempted coup dtat at home in which he felt the us and some eu states had beencomplicit mr putin moved with speed and agility toheal the rift with ankara. realising that mr erdogans main concern was to push back from his frontier syrian kurdish militia, who were allied with kurdish insurgents inside turkey but backed by the us in the fight against isis, mr putin allowed three successive turkish incursions into northern syria, in 2016, 2018 and 2019. but as russia bounced back as a regional superpower itcollidedwith turkeys desire for strategic depth. this february the two countries came to thebrink of warin syria.

Turkeys intervention in libya was intended partly to secure its claim to eastern mediterranean oil and gas riches. in june itturned the tideof the civil war against khalifa haftar, the warlord supported by russia, france, egypt, the united arab emirates and saudi arabia. russia reportedlysent warplanesto eastern libya from north-west syria in response. egypt, backed by the uae and its fighter jets, threatens to invade libya to stop further turkish advances. while ankara appears not to take thissabre-rattlingtoo seriously, there is room for miscalculation.

And so to nagorno-karabakh, where current clashes are the heaviest since a brief but violent spasm in 2016 that killed some 200 people, rekindling fears of a return to the war of the early 1990s.

The region, and its ethnic armenian population, seceded from turkic azerbaijan after the collapse of the soviet union in a conflict that was overshadowed by the wars of the yugoslav succession. now, a major oil and gas pipeline runs from azerbaijan into turkey and on to europe. russia, which has a military base in, and defence pact with, armenia also sells arms to azerbaijan and is seeking todampthe conflict.

Armenian allegations that turkey has sent syrian proxies to the azerbaijani front reprising its syrian militia deployment in libya remain unconfirmed anddeniedby azerbaijan, though it heldjoint military exerciseswith turkey this summer. there is room for miscalculation here too.

Turkey challenging russia in north africa or the levant is not quite the same as a face-off in the caucasus. while that may be former ottoman territory, this is former soviet turf. under mr erdogans authoritarian rule, the conceptual boundary between domestic and foreign policy has been erased. both are fired by a turbochargednationalismas he tries to shore up hisshrinking base. his recourse to hard power abroad, sidelining generations of seasoned diplomats, gives the impression that turkey has gone rogue.

There are certainly takers for that view in the eu and the us. should us president donald trump fail to win re-election in november, mr erdogan will lose theshield his administrationhas provided. all this comes at a time when mr erdogan ispolitically vulnerable; his adventurism could rebound on aweakened economy and currency.

Few modern leaders have so dominated their countries, winning more than a dozen elections and plebiscites over nearly two decades. even fewer have done it while seemingly able constantly to expand their power. if mr erdogan now overreaches he may test this record to destruction.