A murder bid victim launched himself down stairs to get away from a machete thug.
Charles McFarlane was brutally set upon by David Niven, 37, at a friend's house in Kilmarnock on May 2, 2020.
Mr McFarlane was attacked as he went to go to the bathroom.
Prosecutor Neil McCulloch told the High Court in Glasgow: "He was aware of being repeatedly struck to the head and neck with a machete.
"He recalls one of the blows being so hard that he could feel his head being tugged backwards as the blade was pulled out.
"Charles McFarlane struggled with Niven and felt he was fighting for his life.
"He managed to escape by throwing himself down the stairs and running into the street."
Both men knew each other having grown up together in the local area.
The hearing was told the victim suffered "catastrophic" blood loss and needed emergency surgery.
He had a series of wounds including one which had gone through to his skull.
Mr McFarlane luckily survived, but has been left scarred for life.
Niven escaped after the attack, but police arrested him days later as he travelled in a taxi in Kilmarnock.
He was due to go on trial for the attempted murder of Mr McFarlane, but instead pled guilty to the charge.
It emerged Niven already had 43 previous convictions including a jail-term for assault.
Lady Rae sentenced him to 11 years for this latest crime.
Don't miss the latest Ayrshire headlines – sign up to our free daily newsletter here