Before the court was Joseph McCallion (18) of 103 Glenowen Park in Derry who admitted assaulting police and possessing drugs on December 1.
The court was told that a foot patrol stopped McCallion under the Misuse of Drugs Act and searched him.
In his wallet they found two plastic envelopes with a white powder in them.
He was arrested and then tried to escape from custody but was restrained. As he was being led to a vehicle he spat on an officers shoulder and head.
He later told police he had been given the envelopes by a friend and he had sniffed some of it and it had made him 'hyper' he admitted he didn't know what the substance was.
Defence solicitor Mr.Maoliosa Barr said his client knew he was going to jail. He said he wanted custody to see if he could abstain from drugs.
The solicitor said McCallion had been using cannabis since he was 14 and was addicted to the drug.
he said on the night in question he was so intoxicated with drink and drugs that police had to hold him up while they were speaking to him.
District Judge Barney McElholm said that 'people never cease to amaze me, this man sniffed this stuff and he had no idea what it was.' He described the spitting as 'nasty and vile and sentenced McCallion to 6 months in prison.