A man who was caught in possession of a large knife in a public area at Pinderfields Hospital has been jailed for nine months.
Nigel Wood was at the hospital in Wakefield after being taken there when his partner had been knocked down by a bus.
Leeds Crown Court heard the incident happened on July 1 this year when police took Wood to the hospital after his girlfriend was injured.
Bashir Ahmed, prosecuting, said Wood showed the weapon to a member of the public while he was at the hospital.
The matter was reported to security staff who informed police.
Wood was searched and the knife was found in the rear of his trousers.
Wood was interviewed and told police he had the knife "for his own protection".
Mr Ahmed said: "He said there had been trouble in the area and that is why he had it on him.
"He said he had been drinking earlier in the day and had forgotten that he had it."
Wood, of Eden Road, Castleford, pleaded guilty to possession of a knife in a public place.
He has 35 previous convictions, including three for possessing knives in public.
Probation officer Kerrie Wilson said Wood had described in interview how the defendant and his partner had been taking drugs and drinking alcohol on the day of the incident.
Ms Wilson said Wood and his girlfriend then had an argument and she left.
She said: "On her return but unbeknown to Mr Wood she had been involved in a road traffic accident where she had been hit by a bus."
The court heard Wood called emergency services to take the woman to hospital.
Richard Holland, mitigating, said Wood had been held in custody since his arrest.
He said: "He knows some time inside will give him an opportunity to get things straight."
Judge Simon Batiste said: "You have a long history of carrying a knife in a public area.
"You have got to understand that knives can't be carried and if you do you will end up going to prison and the sentences will get longer and longer.
"You are too old to be doing this, to be blunt about it. You need to sort yourself out."