A knife attacker left a delivery driver with his insides “hanging out” during an attempted murder outside a Stockbridge shop.
Aaron Gray, 23, left Mark Miller, 26, bleeding heavily from wounds following the assault near Pizza Hut in Raeburn Place, Stockbridge, on 3 April.
Surgeons carried out an emergency operation on Mr Miller to repair his injured bowel and blood vessels.
The judge deferred sentence on Gray until January for background reports.
Gray admitted attempting to murder Mr Miller.
He had changed his plea during a trial at the High Court in Edinburgh.
Mr Miller, a hospital worker who also worked as a delivery driver for the restaurant chain, said he was heading back to the outlet when he became aware of a male shouting, whom he did not know.
He said he had ignored him and the man left the scene in a car, but returned minutes later and emerged from a passenger door.
Mr Miller said: “He came running towards me. It happened that quick,” he said before the pair got involved in “a scuffle”.
He said: “I managed to get up on to my feet. I was still holding on to him. Then I just let go of him. Then I put my hand down on to my stomach and I realised I had been stabbed. My insides were hanging out.”
Advocate depute Graeme Jessop said Gray claimed he knew Mr Miller which the victim denied.
Mr Jessop said the surgeon was of the opinion that the injuries were actually life-threatening if it was not for the immediate medical intervention.
Police made attempts to trace Gray at several addresses following the attack, before he later handed himself in at a police station.
The victim suffered anxiety and depression following the assault. He said he now finds it very difficult to go out on his own and remains off work following the attack on him, the court heard.