[BBC] This is a historic moment for Sweden, which has spent the past year fighting hard to get accepted into Nato.
The Nordic country previously embraced wartime neutrality for more than 200 years, but applied for membership last May as part of efforts to improve security and stability in northern Europe, following Russia’s invasion of Ukraine.
However, until late on Monday night, Turkey had been blocking Sweden’s application.
Turkey argued Sweden was giving refuge to Kurdish militants, and needed to do more to crack down on rebel groups like the Kurdistan Workers’ Party (PKK), which it considers a terrorist organisation. The EU and US have also designated the PKK as a terrorist group.
Like any of Nato’s 31 member countries, Turkey has the power to block new nations from joining the group.
The outcome of crunch talks with President Recep Tayyip Erdogan is being seen as a major win for Sweden’s right-wing Prime Minister Ulf Kristersson.
While Sweden’s initial application to join Nato was made by Mr Kristersson’s Social Democrat predecessor, Magdalena Andersson, he has made securing membership a key foreign policy priority since taking over as Swedish leader in October.
He told Sweden’s public TV network SVT that he and his team had “worked very hard” to address Turkey’s concerns about terrorism, and that an agreement had been reached after being allowed to showcase their efforts.
“I think we got a chance to also present and show what we have been doing for a long time, and that it is also bearing fruit,” he said. “And I think that together with good support from the work of other countries, all in all, we got it together.”
Sweden introduced tougher anti-terrorism laws in June, making it illegal to give financial or logistical help to terrorist groups.
At the end of last week, that legislation was put into action for the first time, when a Swedish court jailed a Kurdish man for crimes including attempting to finance terrorism, and told him he would be deported afterwards.
Sweden has also resumed armed exports to Turkey.
“We have taken seriously their very legitimate demand that every country that enters the alliance should contribute to additional security,” the prime minister told SVT.
After being photographed beaming in Vilnius on Monday, Mr Kristersson admitted on Swedish public radio that he had enjoyed a quick celebratory beer “with the whole gang” in a conference room after the talks.
This is also a major win for Turkey.
As well as having Ankara’s security concerns addressed, Sweden has promised actively to support Turkey’s efforts to join the European Union, and “step up economic co-operation”.
The entire process has given President Erdogan a huge platform on the global political stage, and plenty of questions remain about what kind of assurances may have been given behind closed doors.
Now that Turkey has ended its opposition to Sweden joining Nato, the US has agreed to fresh talks about Turkey buying F-16 fighter jets.
Some observers including Wolfgang Hansson, a commentator for Sweden’s largest tabloid Aftonbladet, argue that Sweden has potentially been used as a bargaining chip in a much bigger game being played by the Turkish leader.
Public support for Sweden’s Nato application rose sharply following Russia’s invasion of Ukraine, and the issue has remained high on the public agenda over the past year.
“Media coverage of all the twists and turns has been intense, so many people have followed this closely, trying to interpret Erdogan’s every new move,” says Paul Levin, director of Stockholm University Institute for Turkish Studies, who has followed the developments closely.
Yet Sweden’s now increasingly imminent membership won’t be popular with everyone.
According to a May survey by pollster Novus, 38% of Swedes remain either against or unsure about Sweden joining Nato.
Some critics have questioned Sweden’s ideological shift, raising concerns about how it will affect the country’s global image after decades as an international mediator. There are also concerns about the impact of negotiating with Turkey, a nation with a questionable human rights record.
But for Nato supporters Sweden’s membership is essential because it will offer the country additional security guarantees during a volatile period in European politics.
Meanwhile Sweden’s membership will also give Nato additional resources.
Although it does not have a large military, it has re-introduced conscription and boosted defence spending in recent years, with a plan to raise its military budget to 2% of Sweden’s GDP by 2026.