MADRID — NATO leaders will formally invite Finland and Sweden to join the alliance on Wednesday after Turkey lifted its veto on their membership, NATO’s secretary-general said Tuesday evening, clearing the way for what would be one of the most significant expansions of the alliance in decades.
The historic deal, following Turkey’s agreement to a memorandum with the two Nordic countries, underscored how the war in Ukraine has backfired for President Vladimir V. Putin, subverting Russian efforts to weaken NATO and pushing Sweden and Finland, which were neutral and nonaligned for decades, into the alliance’s arms.
After weeks of talks, capped by an hourslong meeting in Madrid, President Recep Tayyip Erdogan of Turkey agreed to lift his block on Sweden and Finland’s membership in return for a set of actions and promises that they will act against terrorism and terrorist organizations.
“As NATO allies, Finland and Sweden commit to fully support Turkey against threats to its national security,” NATO’s Secretary General Jens Stoltenberg said, providing some details of the agreement. “This includes further amending their domestic legislation, cracking down on P.K.K. activities and entering into an agreement with Turkey on extradition,” he added, referring to the Kurdistan Workers’ Party which seeks an independent Kurdish state on territory partly within Turkey’s borders.
Mr. Erdogan had been blocking the Nordic countries’ NATO bids amid concerns over Sweden’s longtime support for the P.K.K. which has attacked nonmilitary targets and killed civilians in Turkey, is outlawed in that country and is designated by both the United States and the European Union as a terrorist organization.
Better Understand the Russia-Ukraine War
But the memorandum does not specify the extradition of any of the 45 people or so Mr. Erdogan wanted sent to Turkey to face trial on terrorism charges. Sweden has already passed tougher legislation against terrorism that goes into effect July 1.
Both Finland and Sweden had been militarily nonaligned for many years, but decided to apply to join the alliance after Russia invaded Ukraine in February. With Russia attacking a neighbor, both countries felt vulnerable, though Sweden, with a long tradition of neutrality, was more hesitant.
President Vladimir V. Putin of Russia warned both countries against joining NATO, but his threats proved counterproductive.
The two countries bring geostrategic benefits to the alliance. Finland shares an 830-mile border with Russia and has a well-equipped modern army; Sweden can control the entrance to the Baltic Sea, which will help a great deal in NATO planning to defend the more vulnerable countries in Eastern Europe.
The final push to resolve the dispute started early Tuesday morning, when President Biden called Mr. Erdogan to urge him to “seize the moment” on the eve of the summit, to allow discussions on other topics to proceed, according to a senior administration official with knowledge of the discussion.
The official, who requested anonymity to discuss private deliberations, said the president conveyed the substance of his conversation with Mr. Erdogan to the leaders of Finland and Sweden. And after several hours of negotiations later that night, the two Nordic leaders consulted with Mr. Biden again before announcing the agreement with Turkey.
The American official said that the deal between Turkey and the two Nordic countries involved a series of compromises on both sides, including the statement by Turkey welcoming Finland and Sweden to apply and issues involving an arms embargo imposed on Turkey and Turkey’s belief that Finland and Sweden had offered safe havens to groups they considered terrorists.
American officials had for days played down Mr. Biden’s role in the negotiations, saying he would not be a broker between the other countries and insisted that it was up to Turkey, Finland and Sweden to resolve their differences.
After the agreement was announced Tuesday night, the senior administration official conceded that it was considered more diplomatic to publicly minimize Mr. Biden’s involvement. Doing so prevented Turkey from seeking concessions from the United States for agreeing to lift its veto, which might have complicated the discussions, the official said.
The next steps for Finland and Sweden are clear: NATO will vote on Wednesday to accept their applications. There will also be a quick study of their defense capacities and needs. But the talks are expected to be routine, since both countries are NATO partners and have exercised together with NATO allies.
The more difficult last step requires the legislatures of all 30 current members to vote to amend the NATO founding treaty to accept the new members. That has in the past taken up to a year, but is expected to be much quicker for the Nordic countries.
The U.S. Senate is already pressing ahead with hearings on the application and Mr. Biden has been a firm proponent of the new members.
Johanna Lemola contributed reporting from Helsinki, Finland.