A Sutton man put a kitchen knife in his sock when he went to King's Mill Hospital during an alcoholic blackout because he was scared of being attacked, a court heard.
A taxi driver alerted security guards after he noticed the blade when he dropped off Richard Bentley at around 9.30pm, on Wednesday, July 17.
"He asked the officer where the A&E department was and he was followed for a short distance before they took the knife from his sock," said prosecutor Robert Carr.
Mary Dixon, mitigating, said Bentley, who is an alcoholic with long-term mental health issues, had blacked out and couldn't recall why he had the knife.
"He had been drinking very heavily and knew he had to get help from the mental health crisis team," she said. "This is all related to his drinking."
Probation officer Cheryl Nisbet said: "He had taken prescription medication and had suicidal thoughts on the night.
"He had the knife with him because he had been told a man who had previously assaulted him has been released from prison and was now looking for him.
"He has been carrying the knife with him for his own protection."
She said Bentley was spending £50 a day on whisky and Special Brew, and suffers from bladder cancer and COPD.
Mrs Dixon urged the bench to step outside their sentencing guidelines as a network of agencies were on hand to help him improve his life.
Bentley, 56, of Clare Road, admitted possession of the blade when he appeared at Mansfield Magistrates Court, on Friday.
A 12 month community order was imposed, with a six month alcohol treatment programme and six rehabilitation days.
He was ordered to pay a £90 government surcharge.