After years of legal twists and turns Sweden has finally axed a law which prevents people from dancing in public without a license.

Swedes danced into the night on Thursday after Sweden's parliament voted to repeal a ban on dancing in public places that dates back to the 1930s, when it was considered that dancing corrupted the morals of Swedish youth, Sveriges Radio reported.

The law required pubs and bars to have dancing licenses, and if patrons started spontaneously dancing without one, the owners of the venue could be fined.

While the police pressed to uphold the ban on the basis that dancing creates fights and disorder, a campaign group led by Sweden's Left Party has finally succeeded in persuading parliament to overturn the ban, having gained the support of the cross-party Justice Committee.

Parliament previously voted to uphold the ban despite a previous campaign in March 2015, and in 2012 more than 1,000 dancing demonstrators took to the streets of Stockholm in protest at the law.

​Police look on as Swedes dance in the street in celebration at the repeal of the dancing ban.

Leader of the most recent campaign, Left Party politician Rosanna Dinamarca, told The Local last week that the law was unnecessary and hard to enforce, since it is difficult to distinguish between "dancing" and customers simply moving parts of their body to a beat.

"It is somewhat absurd and at odds with modern society to have a system where the bar owner does not dare to play music that could encourage dancing and where people are forbidden to spontaneously burst into dance unless there is a special permit," Dinamarca said.

Overturning the ban is set to have a great impact on Swedes' freedom of movement; The Local reported that in Stockholm alone there are about 1,100 bars and restaurants. While the majority play some kind of music, only 100 currently have dance permits.