The Supreme Court on Thursday overturned the conviction of a Norwegian student who threw a cream cake at the country's finance minister the day she took office.

John Waagaard, 25, had acknowledged hitting Finance Minister Kristin Halvorsen with the cake in October 2005, but appealed his conviction and 30-day jail sentence. They were imposed under a little-used legal provision that bars the hampering of a member of government in his or her duties through "violence, threats or other illegal means."

Halvorsen turned her head away when the cake was tossed, and she was not harmed.

Waagaard has said he hoped the "stunt" -- as he called it -- would spark a national debate about the appointment of a politician from the tiny Socialist Left Party to such a key post in the three-party coalition government.

In its ruling, the Supreme Court said the prosecution had not proven that Waagaard broke the law against hampering public officials when seen in light of "his understanding of the consequences ahead of his act."

It said it reversed earlier court rulings in the case because they raised doubts about whether the correct legal provision had been used to convict Waagaard.

The prosecution did not immediately indicate whether it would proceed with its option to charge Waagaard for the attack again and restart the whole legal process.