BAKU (AFP) - Turkish President Recep Tayyip Erdogan on Tuesday pledged support for Azerbaijan if the ex-Soviet country was attacked, as he made a visit to the disputed Nagorno-Karabakh region.
Erdogan s military and political backing was seen as pivotal for Azerbaijan in its war last year with historic rival Armenia, when the two battled fiercly for six weeks to gain control of the mountainous Karabakh region.
The Turkish leader made the pledge of support during an official visit to the symbolic town of Shusha, whose capture by Azerbaijani forces in November last year was a turning point in the conflict.
The fighting was eventually ended when Moscow -- Armenia s primary military backer -- brokered a ceasefire that saw Russian peacekeepers flood the mountainous region inside Azerbaijan that had been held by Armenian separatists.
Erdogan and his Azerbaijani counterpart Ilham Aliyev signed a pledge "to support each other in case of threat or attack by a third country on their independence or territorial integrity."
The fighting last year raised fears that Russia and Turkey could be drawn directly into the conflict to support their allies, interventions that would have put Moscow and Ankara on opposing sides not only in Syria and Libya but in Nagorno-Karabakh too.
Erdogan s pledge to support Azerbaijan if it is attacked mirrors an agreement between Armenia and Russia. The two countries are part of a military alliance of ex-Soviet countries, which Armenia s leaders appealed to Moscow to honour during last year s war.
Ankara was accused by Western countries, Russia and Armenia of deploying Syrian mercenaries to the conflict -- a claim it denied -- while Turkish-made drones overwhelmed Armenia s ageing military, bringing a decisive victory for Azerbaijan.
- Joint drone production -
As part of the truce Russian-mediated truce, Armenia ceded territory its forces had controlled for decades, including the fortress town of Shusha, on cliffs around 15 kilometres (nine miles) from Nagorno-Karabakh s largest city Stepanakert.
Armenia s foreign ministry said it "strongly condemns" Erdogan s visit there, calling it "an outright provocation against regional peace and security."
In Armenia the peace agreement sparked a political crisis, which Prime Minister Nikol Pashinyan has sought to defuse by calling snap parliamentary polls Sunday.
During the visit, Erdogan -- walking over a red carpet -- inspected rows of Azerbaijani troops wearing blue uniforms and carrying rifles against their shoulders with bayonets affixed.
"We are taking measures to make sure the occupation of Azerbaijan s historic lands doesn t happen again," Erdogan said later in a press conference.
"We will give any kind of support needed for our Azeri brothers to return to their homes," he said, referring to the displacement of tens of thousands of ethnic Azeris during fighting for Karabakh in the 1990s.
Aliyev for his part hailed the opening of a transport corridor from Azerbaijan to Turkey via Armenia saying that it "creates great opportunities for the region."
The declaration of military cooperation signed between the leaders in Shusha also calls for Turkey to open a consulate in the town and the for production by Azerbaijan of Turkish military drones.
A senior Azerbaijani diplomat told AFP that during the visit the Turkish leader will also "deliver a speech to the Azerbaijani parliament and on Wednesday attend the Euro 2020 football match in Baku between Turkey and Wales."
Turkic-speaking Azerbaijan s military triumph over Armenia was an important geopolitical coup for Erdogan as Ankara seeks to cement its influence in the ex-Soviet Caucasus region.
Ethnic Armenian separatists in Nagorno-Karabakh broke away from Azerbaijan as the Soviet Union collapsed, and the ensuing conflict has claimed around 30,000 lives.