A drunk who put a homeless man in a headlock to steal his six-pack of beer was spared jail on Thursday by a judge - who had questioned if he was drunk when he turned up to be sentenced.

Michael Dalley, of Amersham Hill in High Wycombe, had been with a group of four others when he encountered the homeless man sitting on the street with the beer, which he had cobbled together enough money to afford, a court heard.

The 25-year-old defendant, who had also been drinking, set upon the victim - punching him in the stomach twice and putting his hands around the man's throat until he surrendered five cans of Stella Artois, prosecutors said.

Police, who went looking for Dalley after a report from an appalled neighbour following the incident on April 21, found him with a can of the lager in his pocket and arrested him, after which the defendant made threats against the homeless man for co-operating with the police, a judge was told.

Judge Thomas Rochford, presiding over a sentencing hearing in Aylesbury Crown Court, was told Dalley had 11 convictions for 14 offences, including other violent incidents.

When Dalley first walked into court, Judge Rochford had asked whether he was fit to be sentenced, noting he "seemed a bit cheerful", adding some defendants had come to court after having been drinking in the past.

However, the judge agreed to suspend the sentence when he heard Dalley just had a generally cheerful persona and had also been homeless until only recently.

Neil Jarvis, defending Dalley, said: "He was at pains to tell me he finds the support network that is now in place for him to be very helpful, to be very encouraging.

"It is the first time that he has had some sort of stability for some period of time."

A probation worker in court said the service was keen for Dalley, who had admitted robbery, to continue working to deal with his alcohol problems, rather than seeing him go to jail.

Judge Rochford, sentencing during a digital hearing on July 2, told the defendant: "What you did on this day was, when drunk, to rob somebody, an innocent man, not perhaps of a huge quantity in terms of value but of five cans of beer that he was looking forward to enjoying and using money he did not have a lot of.

"This was really unpleasant and frightening for somebody who lives on the streets. I know it is a dangerous, difficult place for somebody like that, and for you as well in the past, but the courts really feel that people need to be safe on the street, particularly when it is their home."

Dalley was given a 21-month jail term but was told it would be suspended for 18 months, on condition he completed 10 Rehabilitation Activity Requirement days and an alcohol treatment requirement lasting 12 months.

The judge added: "I think that there are signs that your life is going to turn around and it would be wrong if I sent you to prison, which would put you back. I think that there is a real prospect of you turning around.

"You have really got to make an effort to stay out of trouble. Commit further offences and do not comply with the requirement, you will serve the sentence."