Turkey has agreed to lift its opposition to Sweden and Finland joining Nato, a breakthrough in an impasse clouding a leaders’ summit in Madrid.

After urgent top-level talks, alliance Secretary General Jens Stoltenberg said “we now have an agreement that paves the way for Finland and Sweden to join Nato”.

Russia’s invasion of Ukraine has prompted Sweden and Finland to abandon their long-held non-aligned status and apply to join the security body.

Spain NATO Summit
Nato Secretary General Jens Stoltenberg (Bernat Armangue/AP)

But Turkish President Recep Tayyip Erdogan had blocked the move, insisting the Nordic pair change their stance on Kurdish rebel groups that Turkey considers terrorists.

Finnish President Sauli Niinisto said the three countries’ leaders signed a joint agreement after talks on Tuesday.

Turkey said it had “got what it wanted” including “full cooperation… in the fight against” the rebel groups.

The agreement comes at the opening of a crucial summit dominated by Russia’s invasion of Ukraine.

US president Joe Biden and other Nato leaders arrived in Madrid for a summit that will set the course of the alliance for the coming years.

The summit was kicking off with a leaders’ dinner hosted by Spain’s King Felipe VI at the 18th-century Royal Palace of Madrid.

Spain NATO Summit
The leaders of Turkey, Sweden and Finland sign the agreement (Bernat Armangue/AP)

Mr Stoltenberg said the meeting would chart a blueprint for the alliance “in a more dangerous and unpredictable world”.

“To be able to defend in a more dangerous world we have to invest more in our defence,” Mr Stoltenberg said.

Just nine of Nato’s 30 members meet the organisation’s target of spending 2% of gross domestic product on defence. Spain, which is hosting the summit, spends just half that.

Later on, a senior US administration official said Washington did not offer any concessions to Turkey to coax it to accept the deal to drop its opposition to Finland and Sweden joining.

The official said President Biden made a deliberate choice to keep the US from being a party to the negotiations or being in a position where Turkey could ask for inducements from the US.

The official, who spoke on condition of anonymity to discuss the issue, said Turkey never asked the US for anything as part of the talks.

But the official said the US played a crucial role in helping bring the two parties closer together.

Mr Biden spoke with Mr Erdogan on Tuesday morning at the behest of Sweden and Finland to help encourage the talks.

The leaders of Sweden and Finland reached out to Mr Biden later on Tuesday just before accepting the agreement.