Italy's highest court has ruled that stealing food isn't a crime - so long as you're hungry and the theft was done out of a desperation.

The ruling comes following a controversial case that finds its roots in 2011, when Roman Ostriakov, a homeless 30-year-old Ukranian national, attempted to steal sausage and cheese - worth about $4.50 - from a supermarket where he only paid for breadsticks.

A fellow customer informed the store's security about the attempted theft, and four years later, he was convicted and sentenced to six months in jail with a $115 fine.

The incident gripped the attention of the media and public alike, who were quick to draw parallels between that and the story of Jean Valjean, the protagonist of Victor Hugo's "Les Misérables". In the epic French historical novel, Valjean served time after he was caught stealing bread for his sister's starving children.

After Ostriakov was sentenced, a state prosecutor attempt to make an appeal on a technicality, arguing that he should not have been found guilty of theft, but attempted theft instead, because - as mentioned before - he was caught before he left the store.

However, Italy's Supreme Court of Cassation went one step further and outright threw out the conviction, since, in it's eyes, stealing small quantities of food to satisfy a vital need for food did not constitute a crime.

"The condition of the defendant and the circumstances in which the seizure of merchandise took place prove that he took possession of that small amount of food in the face of an immediate and essential need for nourishment, acting therefore in a state of necessity," the court said in a written ruling.

The ruling received praise among those in the media, with many saying that it was a humanitarian act of mercy.

"The court's decision reminds us all that in a civilized country no one should be allowed to die of hunger," the Italian newspaper La Stampa wrote in a front-page editorial. 

However, some were also critical of the fact that it took the Italian justice system five years to settle case about a theft worth less than $5.

"Yes, you read that right," an opinion column in Corriere della Sera said, "in a country with a burden of €60bn in corruption per year, it took three degrees of proceedings to determine 'this was not a crime'."