A Dundee man broke his curfew after an operation made walking home quickly difficult, a court was told.
Daryl Crookshanks admitted that on April 19, he failed to return to his home address by 7pm, a condition that was part of a bail order.
Defence solicitor Jim Caird explained that his client had poor memory and time-keeping skills, and that on the day in question he misjudged how long it would take to walk home.
He added that the 21-year-old was limping and had difficulty walking due to an operation, which made him 20 minutes late.
Crookshanks is also due to stand trial on five charges including behaving in a threatening and abusive manner, possessing a knife, assaulting two police officers and resisting them while subject to three bail orders, all of which he denies.
Sheriff Drummond granted him bail again despite having “concerns”, warning him that it was his last chance.
Mr Caird said: “He had been at an interview for a college course and was successful.
“He should really have allowed enough time to get home, but he has trouble with his memory and remembering dates and times.”
He said his client misjudged the time it would take to walk from the bus stop to his home address, and was limping as the result of an operation.
“He was limping, and when he got home he found police officers waiting for him. The other offences have been related to drinking.”
Crookshanks, of Emmock Woods Grove, denies that he behaved in a threatening and abusive manner in a Dundee flat by shouting, swearing, brandishing a knife, uttering threats, pursuing others while in possession of a knife.
It is alleged that later he went back to the flat, repeatedly shouted, swore, demanded entry and struck a door.
A second charge states he was in possession of a knife, while a further two charges allege he pushed police officer Emma Claybourne, tried to kick her on the head, and punched her colleague Isman Ali on the head.
Crookshanks is also accused of resisting, obstructing and hindering the two officers at the common close of the flat.
The alleged offences were said to have been committed at Dundonald Street on January 20, while the accused was subject to three bail orders.
A trial date was set for July 18 and Sheriff Drummond imposed a special bail condition confining Crookshanks to his home address between the hours of 7pm and 7am.
She said: “You have failed to attend court when you had to, you have breached your bail conditions and you have a previous breach of bail in August 2017.
“I’ve got some understanding of your background and I’m going to bail you, but it is your last chance to comply with that.
“If you come back on a charge of breaching your bail order again this court will not be able to release you.”