A youth was spotted removing a kitchen knife from his sock before going into a social work office in Motherwell.
A passer-by alerted the police after Aaron Pritchard hid the blade at the side of a building.
Pritchard (18), a prisoner, appeared at Hamilton Sheriff Court and admitted illegal possession of the knife in Merry Street while on bail on August 23. He also admitted threatening behaviour at Wishaw General Hospital and assaulting a police worker.
Defence agent Diarmid Bruce said Pritchard had taken dozens of valium pills that day and the police took him to hospital because they were concerned about him.
Pritchard will be sentenced on October 24.