Turkey announced Tuesday that it would no longer oppose Sweden and Finland joining NATO. This was a breakthrough in an impasse that had engulfed a summit in Madrid. It came amid Europe’s worst security crisis for decades.

Jens Stoltenberg, the alliance secretary general, stated that the agreement “paves the way for Finland or Sweden to join NATO” after urgent talks at the top with the leaders of the three nations. It was a “historic decision,” he said.

One of the many devastating consequences of President Vladimir Putin’s invasion in Ukraine is that Sweden and Finland have decided to leave their non-aligned status and join NATO to protect against an unpredictable and increasingly aggressive Russia. Finland shares a long border to Russia. NATO treaties stipulate that any attack on any member of the alliance would be considered an attack against all members and will trigger a military response from the whole alliance.

NATO works by consensus. Turkish President Recep Tayyip Erdan had threatened to block the Nordic-Turkish pair and insist they change their stance regarding Kurdish rebel groups Turkey considers terrorists.

After weeks of diplomacy, hours of negotiations on Tuesday, the Finnish President Sauli Nisto announced that the three leaders had reached a mutual agreement to end the logjam.

Turkey claimed it had “got everything it wanted”, including “full cooperation…in the fight against” rebel groups.

Stoltenberg stated that leaders of the 30-nation alliance will issue an invitation for the two countries to join the group on Wednesday. All nations must ratify the decision, but Stoltenberg said he is “absolutely confident that Finland and Sweden will become members.” This could be within months.

Magdalena Andersson, the Swedish Prime Minister, stated that the agreement was good for both Finland and Sweden. It’s also good for NATO.

She stated that it was important to complete the membership process “the sooner, the better.”

Andersson stated to the Associated Press that there are 30 parliaments who must approve it.

Turkey celebrated Tuesday’s agreement with the Nordic countries as a victory. It said that the Nordic countries had agreed to take action against groups Ankara considers national security threats. This included the Kurdistan Workers Party (or PKK) and its Syrian extension. They also said that they had agreed to not impose embargo restrictions on Turkey’s defense industry and to take concrete steps to extradite terrorist criminals.

Turkey demanded that Finland, Sweden and Turkey extradite wanted persons and lift arms restrictions after Turkey’s 2019 incursion into northeast Syria.

Turkey agreed to support the invitation from Finland and Sweden to join NATO at the 2022 Madrid Summit.

The details of what exactly was agreed to were not clear. Amineh Kakabaveh is an independent Swedish lawmaker from Kurdish descent whose support the government relies on for a majority at Parliament. She said that it was worrying that Sweden has not revealed what promises it made Erdogan.

Andersson rejected the suggestion that Sweden and Finland had given up too much.

When asked if the Swedish public would see the agreement as a concession regarding issues such as extraditions of Kurdish terrorists by Ankara, Andersson replied that “they will see this is good for Sweden’s security.”

The U.S. President Joe Biden felicitated the three countries for taking “a crucial step.”

An official from the administration said that Washington didn’t offer any concessions to Turkey in order to persuade it to agree to a deal, amid speculation about the U.S. playing a role in ending the deadlock. However, the official stated that the U.S. played an important role in bringing the two sides closer together and that Biden spoke to Erdogan Tuesday morning at the request of Sweden and Finland to encourage the talks.

This agreement was reached at the beginning of a crucial summit that was dominated by Russia’s invasion of Ukraine. It will determine the direction of the alliance in the next years. The summit began with a dinner for leaders hosted by King Felipe VI of Spain at the 18th century Royal Palace of Madrid.

Meetings Wednesday and Thursday will be dominated by strengthening the defenses against Russia and supporting Ukraine.

The invasion of Moscow on February 24th shook European security. It brought back the shelling of European cities and bloody ground combats. NATO, which had been focusing on terrorism and non-state threats, now has to face an adversarial Russia.

Biden stated that NATO is “as united, galvanized and as strong as I believe we have ever been”

The horrors of war were relived Monday by a Russian missile attack on a Kremenchuk shopping center. Some people saw the timing of the attack, which occurred just before the NATO gathering in Germany, and was made by the Group of Seven leaders, as a signal from Moscow.

Volodymyr Zelenskyy of Ukraine, who will address NATO leaders via video on Wednesday morning, called the attack on the mall “terrorist”.

Vitali Klitschko, the Kyiv Mayor, traveled to Madrid to ask the alliance for help in stopping the war.

“Wake up, guys. This is what’s happening right now. Klitschko said to reporters at the summit that you are going to next, and this will be knocking on the door of your house in a blink of an eye.”

Stoltenberg stated that the meeting would create a blueprint for NATO “in a more unpredictable and dangerous world” and that it meant that “we must invest more in defense.” Only nine of the 30 NATO members have met the organization’s goal of spending 2% on defense. Spain hosts the summit and spends only half of that amount.

Stoltenberg announced Monday that NATO allies would agree at the summit increase the strength and number of the alliance’s rapid response force by nearly eightfold, to 40,000 to 300,000. They will remain in their homelands, but the troops will be deployed to certain countries along NATO’s eastern flank. This is where the alliance plans on building up its ammunition and equipment stocks.

There are tensions in NATO about how to end the war and what concessions Ukraine should make.

There are also disagreements about how tough it is to take on China within NATO’s new Strategic Concept, its once-a decade set of priorities. In the 2010 document that was published, China wasn’t mentioned at all.

This new concept will outline NATO’s approach to cybersecurity and climate change issues. It will also reflect the increasing economic and military reach China and the growing power and importance of the Indo-Pacific. The summit will be attended by the leaders of New Zealand, Australia, South Korea, Japan and Australia for the first time.

Some European members are concerned about the harsh U.S. position on Beijing and don’t want China to be seen as an enemy.

NATO will declare Russia the number one threat in its Strategic Concept.

Roscosmos, Russia’s space agency, marked the opening of the summit by releasing satellite images of Madrid and coordinates for the Pentagon.

According to the agency, NATO had declared Russia an enemy at the summit and was publishing exact coordinates “just incase.”