Hang Zhang, 25, of Hawley Street, Sheffield, was arrested on Friday and charged with possession of an offensive weapon, after being found near the South-Centre pedestrian gate of the palace in London.
The Sheffield University student, a Chinese national, was sectioned under Section Two of the Act following an assessment by West London mental health trust, Westminster Magistrates’ Court was told.
Speaking through a Mandarin interpreter, Mr Zhang denied that he lived at the address given to the court.
He was released on conditional bail and was told he must stay on the Burbage Ward at the Michael Carlisle Centre, an in-patient mental health facility in Sheffield, until his next appearance at court.
He smiled and looked upwards as he confirmed he understood the conditions and shook the interpreter’s hand as he left the dock.
The case was adjourned until September 14.