A man who was banned from seeing his girlfriend after an attack on her went back to her home and set it alight, a court has heard.
Several people had to be rescued from the block of flats after Paul McGrath defied a court order to stay away from Lauren Stephen's home.
McGrath, 41, admitted wilfully setting fire to the Perth flat and breaching his bail conditions on 21 May.
Sheriff Lindsay Foulis deferred sentencing to a later date.
McGrath, from Perth, had already been released early from prison for drug dealing when he admitted punching his girlfriend in the face at her flat in October 2009.
He was released on bail and told to stay away from Ms Stephen's home, but defied the court order and set the ground floor flat on fire - despite it being directly opposite Tayside Police's Western Division HQ in Perth.
McGrath, who has more than 20 previous convictions, sparked such a large fire that several residents had to be rescued from the top floor windows.
Police officers who went to the rescue after spotting the smoke from their HQ were left suffering smoke inhalation.
Tayside Fire Brigade had to use an aerial ladder to reach six residents who were trapped on the top floor of the building as it burned in the early hours of the morning.
Sheriff Lindsay Foulis told McGrath he was considering imposing a supervised release order or an extended sentence in order to protect the public.