Roger Morse previously pleaded guilty to offences of affray, common assault against Mark Price, and assaulting by beating of James Babyenni on June 26.
Shrewsbury Crown Court heard that the 45-year-old, who was having relationship problems, was brought to the hospital the night before following an overdose attempt and a stand-off involving police at his Ludlow flat.
He had barricaded himself inside and a specialist negotiator had to be deployed to the property, in Milton Road.
Suzanne Francis, prosecuting, said Morse was taken to hospital for treatment after self-harming at home. She said he had suffered a heroin and tablets overdose.
"The next day he was spotted sitting next to a statue drinking from a wine bottle in the grounds," she said. "He assaulted two security guards."
"The situation escalated when the security guards told him that drinking on the premises was against hospital policy.
"He took exception to this and went mad when he was told to leave the grounds.
"He was shouting and swore at them.
Miss Francis added: "As part of the same incident he tried to steal a car from a member of the public and a motorcycle from a member of staff at the hospital. He said, 'I'm going to jump on one of the bikes' to go.
"He used the neck of a smashed wine bottle to try to intimidate them into handing over their keys, but they both told him to go away in no uncertain terms when he tried to grab their keys.
"It was quite brave of the two motorists to react like that.
"The guards called the police and he was arrested."
When he was sentenced Judge Jonathan Gosling told Morse: "You managed to stay out of trouble for quite a long time, but unfortunately you have gone downhill again due to your relationship problems."
He jailed him for a total of nine months for the offences.
For affray Morse was jailed for five months, for assaulting the two men he was jailed for two months on each count, to run consecutively.
In mitigation on Morse's behalf, barrister Mr Paul Smith said alcohol and drugs were at the root of his problems.
Morse also admitted one charge of affray relating to the same incident. He denied two charges of attempted robbery of motor vehicles which will lie on file.