A Copenhagen court on Thursday convicted a man of “improper treatment of a text of significant religious importance,” the first conviction under a law Denmark passed in late 2023 to stop a wave of Quran burnings that had brought protests across the Muslim world and a security alert at home.

The defendant, Mikkel Ravn, 34, was given a 40-day suspended sentence and ordered to pay 10,000 kroner, about 1,340 euros, in costs. Prosecutors had sought 60 days in prison. The court found that Mr. Ravn had set fire to a copy of the Quran in front of a mosque in the Nørrebro district in May while filming himself, and that he had posted the video with the caption “Try to stop me.”

“The law is not about what the defendant believes,” the presiding judge, Charlotte Winther, said in delivering the verdict. “It is about the act of burning a book in front of the people who hold it sacred, for the purpose of being seen to do so.” The three-judge panel rejected the defense’s argument that the law violated the free-speech guarantees of the Danish Constitution and the European Convention on Human Rights.

Mr. Ravn’s lawyer, Jesper Holm, said he would appeal. “A suspended sentence is still a criminal conviction for what was, until three years ago, a legal if unpleasant form of expression,” he said. “Someone has to take this to Strasbourg, and it may as well be us.”

The 2023 law, which carries a maximum penalty of two years in prison, passed after months of Quran burnings in Denmark and Sweden led to the storming of the Swedish Embassy in Baghdad and warnings from Danish intelligence of a heightened terrorist threat. Critics on the right and left called it a blasphemy law by another name; the government said it narrowly targeted a form of provocation that had become a security problem.

In the three years since, the police have recorded 11 reported violations and brought charges in four. The other three cases were dropped for lack of evidence. Anne Sofie Lund, the prosecutor, said the small number reflected the law’s success. “The burnings stopped,” she said. “That was the point.”

Outside the mosque in Nørrebro, the imam, Yusuf Demir, said the congregation had followed the case closely but without much appetite for punishment. “We did not ask for anyone to go to prison,” he said. “We asked to pray on a Friday without the smell of smoke.”