A man who posted on Facebook that he intended to kill someone before stabbing a man 171 times has been jailed for life for his murder.

Ewan Dow, 25, attacked 21-year-old Daniel Turner with "determined brutality" in Riverside Park in Glenrothes, Fife, on October 18 last year.

He had posted a threat on Facebook before the attack.

Dow pleaded guilty to the murder at an earlier court appearance.

Sentencing him at the High Court in Glasgow today, Lord Turnbull said he must serve 18-and-a-half years before he is eligible for parole.

He said the period would have been 22 years but he reduced it because of Dow's guilty plea.

Lord Turnbull said there was no justification for Dow's attack on Mr Turner.

He said: "You had simply decided that you would vent your frustration and anger and that he was to serve as the victim for that purpose. He was presumably selected because of his placid manner."

Lord Turnbull said that the attack was "truly horrific" and showed "a level of determined brutality which must be responded to severely.

"I can only imagine the infliction of so many injuries must mean that you kept on stabbing him till you reached the stage where you had exhausted yourself.

"Given that you decided with no form of provocation that you were going to inflict wounds on an innocent young man and did so 171 times, this should be treated as an exceptionally serious crime."

He said that Dow had three previous convictions for assault.

In a statement released after the sentencing, the Crown Office said that there is no evidence of any history of animosity between Dow and his victim.

Though they were known to each other through mutual friends, it is unlikely that they ever spent time alone in each other's company before the attack.

The Crown Office said that on the evening of October 17, Dow spent time with friends at a flat in Glenrothes and became drunk and argumentative.

He left and returned to his home on Alexander Road, Glenrothes, and posted "you've got 3 minutes to save ma life" on his Facebook page.

He poured oil on a pillow, placed it in a lit oven in the kitchen and left the flat at around 10.50pm.

Neighbours heard the smoke alarm at around 11.35pm and police and the fire service were called but did not find Dow in the flat and police tried to trace him.

At around midnight Dow went to a property at Greenlaw Crescent, Glenrothes, which was occupied by Daniel Turner and two witnesses.

He repeatedly told them all not to move and threatened to assault them if they called the police before taking a yellow-handled knife, with a blade of six to eight inches, from the kitchen which he repeatedly stabbed into a coffee table.

The two witnesses persuaded Dow to let them leave but Daniel Turner declined to go and stayed in the house.

One of the witnesses contacted the police, and negotiators and armed officers went to the Greenlaw Crescent property. When they entered the house they found that it was deserted.

Between the witnesses leaving the property and the police arriving, Dow and Daniel Turner walked around a kilometre from Greenlaw Crescent into Riverside Park in Glenrothes, where Dow carried out the attack.

At around 6.47am he walked up to the public counter at Kirkcaldy police station. When asked why he was there, he replied: "A murder, last night, it was me, Glenrothes."

Nicky Patrick, procurator fiscal for High Court cases in the east of Scotland, said: "Daniel Turner was a quiet man who was spoken of fondly by every witness interviewed by investigators.

"His murder, during which he was stabbed 171 times, was an unprovoked, cold-blooded act of brutality. Yet again we see the catastrophic consequences that can result from mixing knives and alcohol.

"As prosecutors we will continue to do all in our power to bring those who use knives to face the full force of the law."

Detective Inspector Scott Cunningham, who led the police investigation, said: "Ewan Dow subjected Daniel Turner to an unprecedented level of violence during a frenzied attack, where he clearly lost control.

"Thankfully, Dow pled guilty to this heinous attack, sparing the Turner family from the heartache of a trial.

"I note today's sentence and while nothing will undo the pain they have experienced in losing Daniel, I hope they can now begin to put this traumatic ordeal behind them.

"At this time, I'd like to pay tribute to Daniel's family for the dignity and strength they have shown throughout our investigation. My thoughts are once again with them today."