Magistrates heard Andrew Lord cut his hand inside the Didsbury Street Mosque in Blackburn and was eventually traced through a DNA hit on blood found at the scene.

Asian Image reported, Andrew, 30, of no fixed address, pleaded guilty to burglary in June with intent to steal, failing to comply with post-custodial supervision and possession of cannabis and amphetamine. He was jailed for 14 weeks.

Imposing an immediate prison sentence the chairman of the magistrates said Andrew had the opportunity to take advantage of the help being offered by the probation service but had completely ignored it.

“You have buried your head in the sand,” she said

Tracy Yates, prosecuting, said CCTV had captured a man inside the mosque kicking his way into the office and then using a metal bar to break a window to the prayer room.

“As he broke the window he cut his hand and lost a significant amount of blood,” said Mrs Yates.

The court was told Andrew had not kept his initial appointment or had any subsequent contact with the probation service.

Jonathan Taylor, defending, said following his release from prison Andrew had simply buried his head in the sand.

He had a problem with heroin and things had spiralled out of control.

“I think he realises that he has just been waiting for everything to catch up to him so he can start again,” said Mr Taylor.

The mosque, which was undergoing a £150,000 renovation, also sustained damage during the raid.

The building, which has room for up to 1,000 worshippers, is made up of three wings and includes a partition door to the main wing of the mosque and a staircase to the evening supplementary school and a third vacant wing.

At the time, members of the mosque told of their distress when they discovered the break-in.