A gang of youths torched a police crime scene investigation van when officers were looking into a report of criminal damage at a house in Leeds.
The incident happened when West Yorkshire Police officers attended Ullswater Crescent, in Halton Moor, to a report of a resident smashing a neighbour's window.
Leeds Crown Court heard Alan Lockwood threw a brick through the window of his next door neighbour's home on September 17 this year.
Andrea Parnham, prosecuting, said officers attended two days later in a crime scene investigation van.
Lockwood came out of his home when he saw the van and threw a brick at the vehicle.
The 31-year-old then resisted arrest and ran off.
Miss Parnham said there was a group of youths in the street at the time and they set fire to the vehicle as police officers were chasing after Lockwood.
The prosecutor said: "After police left the scene, the police van was set on fire - not by this defendant."
Officers were also attacked by a group of young people throwing bricks.
More than a dozen children were issued with anti-social behaviour injunctions after the incident.
In his interview, Lockwood said he had been drunk.
Lockwood was released on bail but was in trouble again on September 22.
He banged on a female neighbour's door and threatened to smash her windows.
The court heard he was using a knife to cut his own arm.
One of the woman's young daughters came downstairs and saw what was happening.
Ms Parnham said: "The occupant was fearful of what might happen.
"She took both of her daughters and ran across to her parents who live across the road."
The defendant was arrested and taken to hospital to be treated for his injuries.
He made no comment in his police interview.
Lockwood pleaded guilty to two counts of criminal damage, one count of threatening to commit criminal damage and one count of resisting arrest.
Anthony Sugare, mitigating, said his client attended rehab after the incidents and plans to move into his mother's flat in Batley.
Lockwood was handed a 12-month community order and ordered to complete a 30-day rehabilitation activity requirement.
He was also made subject to a five-year restraining order, banning him from entering two gardens on Ullswater Crescent or throwing any objects into those gardens.
As Lockwood left the court, judge Geoffrey Marson, QC, said: "Please don't come back and cut down the drinking."