Arran Sharp, 41, has previous convictions for violence, York magistrates heard.
He was sectioned under the Mental Health Act with a hospital order at Sheffield Crown Court six years ago and restrictions placed on when he could be released.
His solicitor Keith Whitehouse said Sharp was “released from hospital care” shortly before the incident in York on New Year’s Day.
Sharp, who gave his address as Foss Park Hospital, pleaded guilty to carrying a knife in public in Navigation Road, off Walmgate, York, and his case was adjourned while his defence team seek an “independent” psychiatric report.
Staff from Foss Park Hospital off Haxby Road, York, escorted Sharp to and from his hearing before the York court.
Martin Butterworth, prosecuting, said police were alerted on the morning of January 1 that an incident involving two people had taken place.
Armed officers sent to the scene found two men matching the description of the two involved, one of which was Sharp.
When he was searched, officers found a kitchen knife in his waistband.
He gave no comment when interviewed by police later.
Mr Butterworth said Sharp was “subject to ongoing restrictions out of hospital”.
YOU’LL FIND MORE ON THIS STORY AND OTHERS AT www.yorkpress.co.uk OR PICK UP YOUR COPY OF THE NEWSPAPER ITSELF AVAILABLE SIX DAYS A WEEK AT YOUR LOCAL NEWSAGENT

Overweight or obesity levels for York adults hit 60% - latest figures
Well-known North Yorkshire artist closes gallery in town centre
Scarborough - Graham School to get hundreds of solar panels
York College students set for 40-mile fundraising challenge
York influencer releases heartfelt documentary on iconic Berwick Kaler pantomimes
York restaurant group reports 'record year' as its plans expansion and refurb
York primary school pupil suspended for substance misuse
Flooding possible in York city centre as river levels rise following Storm Goretti


