After 20 months of delays, what was the biggest remaining hurdle to expanding the Western military alliance has now been cleared.

But why did it take so long? And what happens next?

Sweden and Finland asked to join NATO in 2022 following Russia's invasion of Ukraine.

Turkey surprised some members by raising objections.

It said the two countries protected groups that Ankara deems terrorists.

In April of last year, it endorsed Finland's membership but, along with Hungary, kept Sweden waiting.

Ankara had urged Stockholm to toughen its stance on local members of the Kurdistan Workers' Party (PKK), which the European Union and United States also deem a terrorist group.

In response, Sweden introduced a new anti-terrorism bill that makes being a member of a terrorist organization illegal.

In addition, Sweden, Finland, Canada and the Netherlands also took steps to relax Turkey arms-export policies.

Turkish President Tayyip Erdogan has linked Sweden's ratification to U.S. approval of sales of F-16 fighter jets to Turkey - a sale the White House backs.

Now that parliament has ratified the move, Erdogan is expected to sign it into law within days.

That would leave Hungary as the only NATO member state which hasn't approved Sweden's accession.

It had pledged it wouldn't be the last ally to ratify, but its parliament is in recess until around mid-February.

Prime Minister Viktor Orban said on Tuesday he has invited Sweden's leader to visit and negotiate.

Sweden's membership bid marked a historic shift away from decades of military neutrality.

And joining the bloc will enhance NATO defences in the Baltic Sea region.

Ankara's delays, while enabling it to extract some concessions, also frustrated some of its Western allies.