A man who was shot to be brought under control having hurled petrol bombs at police is to remain in hospital.
Krzystof Andruczak turned on a team of officers who attended his flat in Inverness on March 31 last year.
The 41-year-old – who was wearing a gas mask and camouflage clothes – was also armed with two knives and a metal chain.
Police officers escaped serious harm, but Andruczak caused nearly £2m in damage to a block of flats in Polvanie View.
During a clean-up, workmen went on to discover a cache of weapons in the landing including a crossbow, bayonet, slingshot and hatchet.
Andrusczak had faced a series of charges at a hearing in February, including the attempted murder of five police officers, wilful fire-raising and assault.
But, he was acquitted after prosecutors accepted he was suffering from a mental disorder at the time.
A further hearing called at the High Court in Glasgow.
Lord Matthews imposed a compulsion order without limit of time for Andruczak to remain at the State Hospital in Carstairs for treatment.
The court was previously as told how Andrusczak’s sister had raised concerns about him prior to the incident.
She was aware of photos on his Facebook page of knives and bottles which appeared to contain petrol.
The woman went on to contact mental health officials, police and the local psychiatric hospital.
The constables were among those who then turned up at the flat in Polvanie View to talk to Andrusczak.
Officers decided to force entry although it appeared the door had been barricaded.
When police finally got in, Andrusczak was in a “crouched position” clutching a lit petrol bomb as if ready to launch it.
Prosecutor Chris Macintosh said: “There were numerous other unlit petrol bombs at his feet.
“One officer opened an internal door to act as a barrier.
“The constable felt a strong thud to the back of the door, heard smashing glass and then felt an intense burst of heat.”
Police retreated outside before Andrusczak hurled another petrol bomb from a window narrowly missing an officer.
He went on to lower himself down from his first floor flat using a rope.
As the block billowed with smoke, Andrusczak took out two knives from his waistband and began swinging a bike chain.
Police formed a cordon to try and contain him.
Firearms officers eventually arrived at the scene.
A taser was discharged twice and he was also hit with a rubber bullet, but it had no effect.
It was only when he was shot in the leg that he sank to the ground.
The hearing was told the damage Andrusczak caused to the local authority building was “extensive”.
Mr Macintosh said the costs of repairs and having to rehouse other tenants was in the region of £1.8m.
The court heard Andrusczak was suffering from a mental disorder at the time and did not “appreciate the wrongfulness of his conduct”.
Follow STV News on WhatsApp
Scan the QR code on your mobile device for all the latest news from around the country