David Nairne denies murdering 45-year-old Alan Ross in February at a house in Pilton.
But at the High Court in Livingston yesterday, his friend said he had embarked on the attack after a five-hour drinking and drug-taking session.
Kevin Peart said he met Nairne, 26, reluctantly and saw him “covered in blood from head to foot” shortly after admitting he killed Mr Ross.
Mr Peart, 30, then accompanied Nairne back to the bedroom of the dead man’s flat in Pilton Road North, where he saw a mutilated body covered by a white sheet on the floor and walls spattered with blood.
He lifted the bloodstained sheet and felt for a pulse, but Mr Ross was dead with multiple stab wounds to his neck and face.
Mr Peart, 30, originally from Dingwall, said that just over an hour earlier he had left Nairne alone with Mr Ross, with whom Nairne had allegedly been having sex.
He admitted that he and Nairne were “legless” after a five-hour drink and drugs binge that Saturday afternoon.
The pair, who regularly drank 15-20 litres of cider a day, were “extremely drunk” on a cocktail of white cider and valium, he claimed.
He told police Nairne had also taken ketamine – a horse tranquilliser, which made him “very violent” and “bonkers” – earlier that day.
When they started to run out of alcohol the pair went to visit Mr Ross because they knew he had more drink at his home.
Mr Peart went home to play a game of online poker he had booked for 11pm. An hour later he learned from Nairne that Mr Ross was dead.
Nairne, 26, a prisoner at Edinburgh, is standing trial accused of murdering Mr Ross in February this year.
He has also pleaded not guilty to attempting to defeat the ends of justice by setting fire to the dead man’s clothing, making an explosive device by putting household chemicals in a microwave and disposing of evidence, including two knives.
He further denies headbutting Mr Ross in the Capital’s Mathers Bar seven months before the killing.
Mr Peart told the jury he called his friend just after midnight and Nairne said: “I need help. Get back over here now.”
Asked by Peart why he had murdered Mr Ross, the accused said he didn’t know.
The trial continues.