A yob pelted police officers with tins of food and climbed on to the roof of his house during a seven-hour stand-off.
Stuart Connal's street was sealed off and the gas supply disconnected after he threatened to torch his home.
He also warned he would kill any police officer who tried to arrest him.
Serial offender Connal, 43, was jailed for 16 months when he admitted threatening or abusive behaviour at his home in Neilsland Street, Hamilton.
He also admitted spraying an unknown substance in PC Christopher Leyden's face and hitting PC Nathan Gilchrist with a glass jar.
Hamilton Sheriff Court heard that officers went to the street at 7.30pm on December 18 after complaints that Connal was banging on windows.
Alice Carey, prosecuting, said: "Connal refused to open his door to the police. He threw an aerosol can from a bedroom window and threatened to 'light the place up'.
"Concerned that he would set fire to the property, PC Leyden opened the letterbox to smell for any accelerant and the accused squeezed an unknown substance in his face.
"He said he had petrol and was going to set fire to the property.
"In response, neighbours in the block were evacuated and the fire service switched off the gas supply.
"Connal threw tins and jars of food towards the police officers and a jar of pasta sauce struck PC Gilchrist on the thigh.
"Police then cordoned off the entire street and negotiators tried to engage with the accused, but their efforts proved futile."
Connal warned he "would kill any officers who came through the door" then started hurling tins of paint and pieces of wood at them.
Ms Carey added: "He made a hole in the loft and climbed on to the roof where he continued to act in an aggressive manner for two hours.
"He again threatened to kill any officer who approached and warned he would 'do himself in'.
"He had a shard of glass in his hand at this time."
The stand-off finally ended at 2.30am when Connal climbed down from the loft area.
He was taken to hospital for treatment to a hand injury.
None of the police officers were injured.
Defence agent Jackson Bateman said Connal had been struggling to cope with a divorce and the death of his father.
The lawyer added: "He suffers from post-traumatic stress disorder, anxiety and depression, and hadn't taken his medication that day. He's genuinely sorry."
Sheriff Liam Murphy noted that Connal was subject to bail and anti-social behaviour orders at the time and has "a number of previous convictions".
The sheriff added: "This behaviour towards the police went on for some hours. There is no alternative to a custodial sentence.
"It would have been two years, but I'll reduce that to 16 months because of your guilty plea."
Don't miss the latest headlines from around Lanarkshire. Sign up to our newsletters here.
And did you know Lanarkshire Live is on Facebook? Head on over and give us a like and share!