MADRID/HELSINKI (Reuters) - NATO ally Turkey lifted its veto over Finland and Sweden's bid to join the Western alliance on Tuesday after the three nations agreed to protect each other's security, ending a weeks-long drama that tested allied unity against Russia's invasion of Ukraine.
The breakthrough came after four hours of talks just before a NATO summit began in Madrid, averting an embarrassing impasse at the gathering of 30 leaders that aims to show resolve against Russia, now seen by the U.S.-led alliance as a direct security threat rather than a possible adversary.
It means Helsinki and Stockholm can proceed with their application to join the nuclear-armed alliance, cementing what is set to be the biggest shift in European security in decades, as the two, long-neutral Nordic countries seek NATO protection.
"Our foreign ministers signed a trilateral memorandum which confirms that Turkey will ... support the invitation of Finland and Sweden to become members of NATO," Finnish President Niinisto said in a statement.
The steps for Finland and Sweden's accession to NATO will be agreed on in the next two days, Niinisto said.
NATO Secretary-General Jens Stoltenberg and Turkey's presidency confirmed the accord in separate statements, after talks between the NATO chief, Turkish President Tayyip Erdogan, Swedish Prime Minister Magdalena Andersson and Niinisto.
"Key memorandum just reached between Sweden, Finland and Türkyie. Paves way for Swedish accession to NATO," Andersson said in a Twitter post.
RESPONSE TO RUSSIA
The resolution of the deadlock solidifies the alliance's response to Russia - particularly in the Baltic Sea, where Finnish and Swedish membership would give NATO military superiority.
In the wider Nordic region, Norway, Denmark and the three Baltic states are already NATO members. Russia's war in Ukraine, which Moscow calls a "special military operation", helped overturn decades of Swedish opposition to joining NATO.
U.S. President Joe Biden and British Prime Minister Boris Johnson welcomed the deal.
Biden, in a Twitter post, called it a "crucial step towards a NATO invite to Finland and Sweden, which will strengthen our Alliance and bolster our collective security."
Johnson called it "fantastic news" to start the summit.
Stoltenberg said NATO's 30 leaders would now invite Finland, which shares a 1,300 km (810-mile) border with Russia, and Sweden to join NATO and that they would become official "invitees". He told reporters: "The door is open - the joining of Finland and Sweden into NATO will take place."
However, even with a formal invitation granted, NATO's 30 allied parliaments must ratify the decision by leaders, a process that could take up to a year.
TERMS OF THE DEAL
Turkey's main demands, which came as a surprise to NATO allies in late May, were for the Nordic countries to stop supporting Kurdish militant groups present on their territory, and to lift their bans on some sales of arms to Turkey.
Stoltenberg said the terms of the deal involved Sweden intensifying work on Turkish extradition requests of suspected militants and amending Swedish and Finnish law to toughen their approach to them.
Stoltenberg said Sweden and Finland would lift their restrictions on selling weapons to Turkey.
Turkey has raised serious concerns that Sweden has been harbouring what it says are militants from the banned Kurdistan Workers Party (PKK), which took up arms against the Turkish state in 1984. Stockholm denies the accusation.
The Turkish presidency statement said the agreement reached on Tuesday meant, "Full cooperation with Turkey in the fight against the PKK and its affiliates."
It also said Sweden and Finland were "demonstrating solidarity with Turkey in the fight against terrorism in all its forms and manifestations."
Biden, in public comments with Spanish Prime Minister Pedro Sanchez and King Felipe of Spain, stressed the alliance's unity, saying NATO was "as galvanized as I believe it's ever been."
A senior administration official said Washington had pursued a low key approach and insisted that Turkey had not linked its longstanding request for F-16 fighter jets to secure the deal.
Biden will meet Erdogan during the summit. Erdogan said before leaving for Madrid that he would push Biden on an F-16 fighter jet purchase.
He said he would discuss with Biden the issue of Ankara's procurement of S-400 air defence systems from Russia - which led to U.S. sanctions - as well as modernization kits from Washington and other issues.
(Additional reporting by Tuvan Gumrukcu in Ankara and Ali Kucukgocmen and Daren Butler in Istanbul, Andrea Shalal and John Irish in Schloss Elmau in Germany, Simon Johnson in Stockholm, Belen Carreno in Madrid, Writing by Robin Emmott, Editing by Mark Heinrich and Grant McCool)