A gun-toting teenager who targeted a sheltered housing complex has been locked up for four years after a judge branded him as being out of control.

The 15-year-old, who cannot be named for legal reasons, was involved in a terrifying early-hours burglary at the Pembroke Court complex in Girlington, Bradford, in April.

And only four days later he tried to gain entry to another flat at the same complex by pointing an air pistol at the head of 57-year-old resident Lucjan Romanowski.

Bradford Crown Court heard today how Mr Romanowski realised the weapon was an imitation and courageously pushed it away, but the teenager then fired the handgun towards him. The pellet lodged in a doorway.

The Honorary Recorder of Bradford Judge Stephen Gullick said the incident showed that the teenager posed a significant risk of serious harm to the public.

Although the boy will only serve a maximum of two years in detention the judge also imposed an extended three-year licence period following his release.

'Had you been ten years older the sentence you would have received would have been substantially longer than the sentence I'm about to impose upon you,'' he told the youngster, who only turned 16 earlier this month.

'I've read in your case a pre-sentence report and a plea from your mother who frankly must wonder what it is she must do to try to ensure that you behave yourself.

'It's quite clear to me that these activities of yours suggest that you are totally out of control.'' Prosecutor Ewan McLachlan outlined details of the boy's catalogue of offending which included mobile phones robberies together with the early-hours burglary of the occupied flat in Pembroke Court and the attempted robbery of Mr Romanowski.

In January the teenager, 17-year-old Mohammed Bashir and a third youth confronted two teenage boys in Bradford city centre and stole their mobile phones from them.

The 15-year-old was on bail for that incident when he broke into the flat at Pembroke Court after he and his accomplice had stolen keys from a secure box near the warden's office.

Mr McLachlan described how 61-year-old John Simpson had been returning home from work when another resident told him that two youths had been trying keys in the door of his flat.

Mr Simpson went into the flat where his wife had been asleep in bed and found the two youths in the bathroom.

As he dialled 999 and called for his wife the youths barged their way out knocking Mrs Simpson to the floor.

The duo had managed to steal cash, cigarettes and a lighter from Mrs Simpson's handbag.

Four days later the 15-year-old and two others were outside the same sheltered complex in the early hours when Mr Romanowski decided to go out for a walk.

On his return the teenager produced the imitation gun and held it to the victim's head ordering him to open the door.

'Mr Romanowski was petrified,'' said Mr McLachlan.

'He thought he may die if he was shot although he appreciated at the time that the gun was an air weapon.'' The teenager was joined by his accomplices who searched Mr Romanowski's pockets, but the complainant then became angry and pushed the gun causing the youths to run off.

The teenager fired the airgun as they left and Mr McLachlan revealed that he was later arrested by firearms officers after threatening staff at a city centre nightclub.

The court heard that the youngster had pleaded guilty to offences of robbery, burglary, attempted robbery and possessing an imitation firearm with intent.