A man who stabbed his friend more than 30 times at a flat in Edinburgh has been jailed for nine years.

Slawomir Lipinski, 36, attempted to murder Martin Komosinski during an attack on Duke Street in Leith on February 6, 2016.

The High Court in Edinburgh heard Lipinski believed Mr Komosinski, who had been visiting the flat, had stolen his bank card.

This caused the supermarket cleaner, who had been drinking vodka heavily, to knock his victim to the ground and stab him repeatedly.

When police officers arrested Lipinski, he told them: "I wasn't trying to kill him, for sure, no way. Not attempted murder."

Lord Pentland told Lipinski, who earlier pleaded guilty to attempted murder, he had no other option but to send him to prison.

He said: "By the terms of your guilty plea, you have accepted that the attack was a murderous one.

"It was indeed an attack in which you displayed extreme violence because your victim was found to have more than 30 stab wounds on his body.

"He was fortunate to have such survived such a vicious and sustained onslaught."

He added: "The fact that you were drunk is no excuse at all for what you did.

"Instead, I regard it as an aggravating factor, as is the fact that the attack involved the repeated use of a weapon.

"There is nothing in the background or surrounding circumstances that could amount to provocation as a matter of law."

The court heard how the attack took place at Lipinski's home.

Prosecution lawyer Owen Mullan said Lipinski, the victim and another man had been at the flat and consumed "a large amount of vodka".

A flatmate of the accused was later wakened by the sound of a disturbance, hearing Lipinski shout: "You tried to rob me."

Mr Mullan said the flatmate found Lipinski having trouble getting to his feet as he was so intoxicated and saw Mr Komosinki lying face down on the floor.

The 28-year-old victim was moving his arms but wasn't saying anything.

Police later arrived and arrested Lipinski.

Medical staff who treated Mr Komosinski at Edinburgh Royal Infirmary found him to have sustained "upwards of 30 stab wounds" to his back and further injuries to his face and head.

On Wednesday, defence solicitor advocate Euan Roy told the court his client had trouble accepting he was capable of such violence.

He added: "He still struggles to accepted the enormity of the events of that evening. He presents as some one who is quite agitated, anxious and upset when the evidence is mentioned and he is appalled at the level of the injuries suffered by the complainer.

"He cannot fathom that he is responsible for the extreme level of violence suffered by the complainer. He fully accepts that he will be made the subject of a lengthy prison sentence."