Denmark's parliament on Thursday passed a law making it illegal to burn the Quran in public places, Reuters reported.

The vote followed a five-hour debate in parliament. 94 members voted in favor and 77 against.

Breaking the new law will be punishable by fines or up to two years in prison, the government has said.

The legislation was approved after a spate of Danish protests during which Islam's holy book was burned, causing outrage in the Muslim world.

Denmark and Sweden experienced a series of public protests this year where anti-Islam activists burned or otherwise damaged copies of the Quran, triggering demands that the Nordic governments ban the practice.

In late July, Denmark’s Foreign Minister Lars Løkke Rasmussen said the government will seek to make it illegal to desecrate the Quran or other religious holy books in front of foreign embassies in the country.

According to Justice Minister Peter Hummelgaard, more than 500 demonstrations that included burnings of the Koran or flags were registered since July.

"Such demonstrations can hurt Denmark's relations to other nations, our interests and ultimately our safety," Hummelgaard said, according to Reuters.

Denmark's centrist coalition government has argued that the new rules will have only a marginal impact on free speech and that criticizing religion in other ways remains legal.