Turkish President Recep Tayyip Erdogan (center), NATO Secretary-General Jens Stoltenberg (third from left), Finland's President Sauli Niinisto (fifth from left), Sweden's Prime Minister Magdalena Andersson (sixth from left) and other officials attend a signing ceremony of a memorandum on the Nordic countries' NATO bids in Madrid, Spain on June 28.

Editor’s Note: A version of this story first appeared in CNN’s Meanwhile in the Middle East newsletter, a three-times-a-week look inside the region’s biggest stories. Sign up here.

Abu Dhabi, UAE CNN  — 

NATO formally invited Finland and Sweden to join on Wednesday after Turkey dropped its opposition following an arduous process that has served to remind the alliance of its deepening fault lines.

Finnish President Sauli Niinistö said that Ankara had agreed to support the membership bids of his country and Sweden, removing a major hurdle to the two joining the alliance.

While the move was a big win for NATO and a setback for Russia, Turkish President Recep Tayyip Erdogan didn’t give in without a fair share of political chest-thumping as a display of his nation’s weight in the grouping.

Before signing a joint memorandum with the two Nordic nations, Erdogan on Tuesday declared that NATO “cannot afford” to lose Turkey as a member. He was responding to frustration in the Western alliance over Ankara’s opposition to the admission of the two traditionally neutral countries that felt compelled to join the grouping by Russia’s invasion of Ukraine.

Turkey has become a headache for NATO. But recent geopolitical events have shown that it’s one the alliance will have to tolerate. Experts say Erdogan knows that well and has used his country’s place in the grouping to serve its national interests.

In a European war that has essentially become a conflict between the Kremlin and NATO, Turkey has positioned itself as a neutral party, opting not to join its allies in sanctioning Russia while offering to mediate between the warring parties. It has supported Ukraine in the war but has been careful not to antagonize Moscow.

Experts say Turkey is today more valuable than ever to NATO. The country sits at the south-eastern flank of the alliance, a key buffer between Russia and the West. It maintains the second-largest army in the alliance after the US, and borders a swathe of Middle Eastern nations with a history of political instability, and where Western states have major interests.

Ankara, however, hasn’t always been a thorn in the side of the alliance.

Why NATO is so significant in the West's relationship with Russia
03:50 - Source: CNN