Mohammed Nur, 34, of Somalia, was jailed for 18 months after he pleaded guilty to stealing cash from a van in Marsa at around 5pm yesterday.
Mr Nur, who resides at the Marsa open centre, was also charged with slightly injuring the owner of the vehicle.
Police Inspector Robert Vella explained to Magistrate Neville Camilleri that the van owner, Domnic Spencer, parked outside a shop in Marsa and went in to buy something.
When he came out, he found the accused in the van, where he had some money in the dashboard. He tried to pull Mr Nur out of the van but he became aggressive and injured him, Insp. Vella said.
Mr Nur also pleaded guilty to being in possession of a knife, breaching the peace and committing a crime during the term of suspended sentence.
Lawyer Cedric Mifsud, appearing as legal aid, said his client had problems because he was an immigrant and could not find a job, which led to him "doing these stupid things".