(CNN) -- An Iranian judge has sentenced a man accused of stealing chocolate and cocoa from a candy shop to have his hand cut off, the semi-official Fars News Agency reported Saturday.

"Considering the confession of the defendant and the fact that he was found guilty of breaking and entering, according to the Quran, he deserves to have his hand cut off," Fars quoted the judge as saying as he ordered the sentence.

The 21-year-old man, whose name was withheld by the court, was arrested in May while driving in a suspicious manner, Fars reported. During the arrest, police recovered cash as well as chocolates and cocoa.

"After the man was taken to a police station, a report of a robber at a candy store was received by police," Fars said.

Police told Fars that the man later confessed to robbing the store. In addition to the amputation sentence, the man was ordered to spend six months in prison for destruction of property and an additional six months for resisting arrest, according to Fars.

Such an amputation sentence is often handed down to habitual thieves in Iran who have prior convictions for theft and robbery.

CNN's Shirzad Bozorghmehr contributed to this report.