A homeless man who stole a paintball gun when he raided a student house was caught as he walked down the street carrying his haul, Lincoln Crown Court heard.
Steven Shackleford was carrying the weapon over his shoulder in a firearms bag when police officers spotted him in Newland Street West in Lincoln.
The officers, who knew Shackleford, followed him and he was detained after cutting along a footpath to St Faith’s Street.
Stephen Taylor, prosecuting, said the airsoft weapon was recovered and found to have been taken during a burglary of a student property in Wellington Street.
Shackleford later told police he was tipped off that the house had already been burgled but there were still items worth taking.
He said he then went to the property himself and took the weapon which he planned to sell so he had money for heroin and food.
Shackleford, 30, of no fixed address, admitted burglary on June 21 this year.
Sunil Khanna, defending, said that at the time Shackleford was homeless after losing his supported accommodation for breaking the rules.
Shackleford then missed an appointment for his methadone prescription which left him without any medication.
Mr Khanna said: “That led to him going back to heroin. He was looking at ways to get money.
“He was told that this house had been burgled so he went there and found the paint gun. He was walking around with the rifle bag over his shoulder and the police saw him and followed him.”
Mr Khanna said that since his arrest Shackleford has spent nine weeks in custody.
“He needs help. He wants to be able to conquer this addiction,” Mr Khanna said.
Shackleford was given a two year community order with 30 rehabilitation requirement days. He was also given a six-month drug rehabilitation requirement.