(Bloomberg) -- The talks with the Turkish president had been going around in circles for hours on Tuesday afternoon when the delegations decided to take a breather. 

At stake was whether Sweden and Finland would be able to move forward with their applications to join NATO and ahead of the meeting their expectations had been limited. Turkey’s Recep Tayyip Erdogan was reiterating his demands that his counterparts from Stockholm and Helsinki crack down on Kurdish groups that Ankara views as terrorists in order to lift his veto on their accession. That looked politically impossible. 

“During the first two hours, nothing moved,” Finnish Foreign Minister Pekka Haavisto said in an interview. “But then there was a coffee break.”

When they returned to the negotiating table, the two sides managed to hammer out a way for the two Nordic countries to address Erdogan’s security concerns that was palatable for both sides. 

“Sweden and Finland were able to explain our work against terrorism and how we have tightened legislation and will continue to strengthen it,” Swedish Prime Minister Magdalena Andersson said in an interview. 

“During the coffee break there’s always a possibility to use a bit of creativity and find language that suits everyone,” Haavisto added. “We succeeded on that.”

The move will reshape European defense by lengthening NATO’s border with Russia and offering more protection to the exposed Baltic countries on the alliance’s eastern frontier. It capped more than a month of sometimes acrimonious negotiations and periods of Turkish stonewalling as Sweden and Finland tried to convince Ankara to remove its block. All 30 members need to sign off on the process. 

Andersson, Finnish President Sauli Niinisto and NATO chief Jens Stoltenberg met with Erdogan for four hours ahead of a NATO summit in Madrid to hammer out the agreement. Stoltenberg and Erdogan also had a one-on-one. 

The meeting between Erdogan and Stoltenberg was “more of the social kind and during that delegations were engaged in talks over several variations,” Niinisto told reporters. “The final wordings were crafted in the hallways.”

Haavisto added that many NATO members had communicated with Erdogan, including US President Joe Biden, underscoring the importance of reinforcing the alliance’s open-door policy. 

A senior US administration official said Biden’s goal this week was to help get the deal across the finish line. Biden told Erdogan Tuesday morning in a phone call that he should seize the moment and finalize negotiations for an agreement during the Madrid summit. 

There were no US concessions to Turkey to get the deal completed and Turkey never tied long-standing requests like F-16 fighter jets to any agreement to allow Sweden and Finland to begin the process of joining the alliance, the official told reporters Tuesday evening after it was announced. All the same, Assistant Defense Secretary Celeste Wallander said the US supports Turkey’s plans to modernize its F-16 fleet.

Finland and Sweden will still face a period of uncertainty while they await formal approval from member nations and before the military alliance’s mutual defense clause takes full effect.

“We’re concerned about what is called the gray zone -- between putting in the application and finally getting the green light -- means for our security,” Haavisto said, adding that Russia’s war in Ukraine adds an element of chaos to the situation. “We have an unpredictable period.”

©2022 Bloomberg L.P.