Police disturbed a burglar inside a student house in Huddersfield after a call from an alert neighbour.

Leeds Crown Court heard Adrian John Gilroy was seen acting suspiciously near the property in Somerset Road, Almondbury, around midnight on July 10.

Michael Smith, prosecuting, said the students who lived in the property were on a night out. The neighbour saw a man walking toward the house with a piece of wood or wooden crate and called the police.

Meanwhile, Gilroy used the object to get into the house through a window and once inside he went through a number of rooms selecting property such as laptops and electronic games which he put into a plastic bag.

When police arrived they could see him inside with the bag but when they challenged him from outside he abandoned the bag and fled one way as the police got inside through another.

He got away from the scene but was arrested later that night and said: “What have I got myself into?”

The stolen property had not been taken away and also a bag was found nearby containing Gilroy’s personal papers including his passport.

Mr Smith told the court Gilroy was on licence at the time of the offence from a 32 month prison sentence for burglary imposed in February 2014. Because of his previous record for burglary he was also liable for a minimum sentence.

Mark McKone, representing Gilroy, told the court he was released from his last sentence in June last year and managed to stay out of trouble for 13 months with the help of the probation service.

He had started up his own painting and decorating business but got into debt paying for his supplies and became depressed. He then returned to using drink and drugs which was something he did when depressed.

On the night concerned it was drink more than drugs which triggered his offending when he was not thinking rationally. Having his passport with him showed it was not pre-planned.

Gilroy, 32, of Longley Road, Lowerhouses, admitted burglary and was jailed for 876 days.

Judge Christopher Batty told him: “You have to understand when things go against you drink and drugs are not the answer. You’re old enough to know that but only you can sort it out.”