A man who stabbed three men was disarmed when a taxi driver pushed a wheelie bin at him, Inverness Sheriff Court has heard.
The driver's actions caused drunken Blair Cotter to drop his knife.
The court heard that the 21-year-old launched a series of unprovoked attacks in Inverness on 13 February.
Cotter, described as a prisoner in Inverness, admitted the assaults. Sheriff Ian Abercrombie jailed him for 32 months.
The sheriff also ordered Cotter to be placed on a supervised release order for one year.
Taxi driver Douglas Stewart, 47, was the man's third victim.
Mr Stewart had returned home from working a shift when Cotter appeared near him "making repeated slashing movements with the knife".
He struck several times, causing injury to Mr Stewart's hand and nose.
The attack was witnessed by the taxi driver's teenage daughter and several others.
Depute fiscal Ron Phillips said: "Fortunately Mr Stewart was able to manoeuvre a wheelie bin between him and the accused.
"He kicked the bin, thereby causing it to make contact with the accused, who in turn dropped the knife which Mr Stewart was able to retrieve and later surrender to police.
"This horrific attack could have had grave consequences and was witnessed by the victim's own daughter."
Sheriff Ian Abercrombie said someone could have been killed.
He said: "This was an appalling course of conduct. You can't handle alcohol."