A van driver reversed at high speed in a bid to ram a police car that was chasing him after a disturbance at a caravan site.
William McPhee also sped through red lights and went the wrong way on a roundabout.
When finally arrested he spat at a police officer.
McPhee, 21, a prisoner, formerly of Kirkcaldy, appeared at Hamilton Sheriff Court.
He admitted driving dangerously, having taken drugs, driving without a licence, having no insurance and police assault.
McPhee had been held in custody since his arrest in June but a sheriff freed him after hearing he plans to move in with his family in Dundee.
Tried to cause police collision
The court heard police were called to a disturbance at Cots Castle caravan site, near Stonehouse, Lanarkshire, at night on June 2.
Jennifer McCabe, prosecuting, said: “Officers saw the accused driving a Ford Transit tipper van away from the caravan site and towards them at excessive speed.
“They pursued the van on to the A71 where it overtook other vehicles, causing oncoming drivers to brake sharply.”
McPhee failed to give way at roundabouts and went through several red lights.
Ms McCabe added: “The accused drove on to Ayr Road in Larkhall and slammed on his brakes, hoping the police would collide with the rear of his vehicle.
“This caused the police driver to carry out an emergency stop.
“McPhee then reversed at high speed towards them for about 100 metres, forcing the officer to do likewise.
“The police officers could see the accused was deliberately trying to ram their vehicle and they were in a state of fear and alarm.”
Caught after running off
McPhee sped off towards nearby Rosebank, having switched off his lights.
Finally, he and a male passenger abandoned the van in a hotel car park and ran off, but they were caught a short time later.
The fiscal said: “The accused appeared to be under the influence of drugs and became hostile towards the police.
“He spat at one officer, telling him he had Covid-19.
“The spittle didn’t make contact and McPhee went on to say he didn’t have the virus.”
Moving to Dundee
At the time of the offences McPhee was on bail in relation to cases in Kirkcaldy and Alloa.
Defence lawyer Sandy Morrison said: “His offending appears to have co-incided with being estranged from his family and his involvement with a peer group and drugs.
“He has had plenty of time while in custody to reflect on the way he was conducting his life during that period.
“A community payback order would assist him with a view to preventing further offending.
“He hopes on his release to return to his family in Dundee.”
Sheriff Andrew McIntyre said it was “a shocking course of conduct” but given the accused’s youth and the time he’d spent in prison a non-custodial sentence was appropriate.
McPhee was placed under supervision for a year and ordered to do 180 hours of unpaid community work.
He was also disqualified from driving for 28 months and must resit his test.