A 19-year-old man is facing a jail term of at least six months – and potentially as long as four years – after he used a knife to threaten a police officer.

James Gray, of Northfield, Barlby, is one of the first people in the country to be charged under a new law aimed at cracking down on knife crimes.

At York Magistrates Court, he pleaded guilty to a string of offences committed in his street shortly before midnight on Tuesday evening. After hearing from the prosecution and defence, magistrates decided the case was too serious for them to deal with and sent him to York Crown Court where he will be sentenced on May 30. Gray admitted having a knife in public and threatening to use it to cause serious physical harm to a person with it, affray and criminal damage to a police car.

He was released on bail on condition he observes a nightly 12-hour curfew, keeps out of licensed premises and keeps away from Osgodby.

The new law came into effect on December 3 and followed several attacks, some fatal and involving young people, in which knives were used. It increased the maximum sentence from two to four years and introduced a minimum sentence of six months in most cases.