A former prisoner will win a payout from the Scottish Government after he was subjected to a vicious murder bid by a violent racist in jail.
Daniel Kaizer claimed the prison system failed to protect him from his attacker after he was subjected to a threat in the gym at Craiginches Prison in Aberdeen a week earlier.
Mr Kaizer, who is originally from Poland, suffered a fractured skull after Keith Porter attacked him with a steel bar bell on December 4, 2009, while he was exercising at the gym.
Porter, who had tried to murder another Polish man in July that year, was later given a life sentence under an Order for Lifelong Restriction following the attack on Mr Kaizer.
Mr Kaizer, 35, of Aberdeenshire, sued Scottish ministers, who are responsible for the Scottish Prison Service (SPS), at the Court of Session in Edinburgh for damages following the racially motivated murder bid.
On Tuesday, a judge ruled in his favour and found they had failed in their duty of care to the former prisoner and were liable.
A further hearing will decided the level of damages to be awarded in the action, in which Mr Kaizer sued for £900,000.
Mr Kaizer claimed the attack was the carrying out of the earlier threat made to him by Porter.
He had reported the threat to a prison officer, Gary Lumsden, at the time.
Lord Ericht said: "The threat which was made by Mr Porter and reported to Mr Lumsden demonstrated that the pursuer was at particular risk of violent attack.
"Mr Porter made a specific threat to smash the pursuer's face in. The pursuer informed Mr Lumsden of the threat. Mr Lumsden should have reported the threat but he failed to do so.
"Mr Lumsden did not take reasonable care to prevent the implementation of the threat by reporting it."
He added: "Had Mr Lumsden reported the threat, on the balance of probabilities the attempted murder would not have taken place."
Mr Kaizer, a former construction industry worker who was on remand at the time of the murder bid, was later given a ten-week jail sentence for assault.
He told the court that in the initial incident in the gym Porter had been "really verbal to me".
Mr Kaizer said he gone to speak to one of the prison officers, Mr Lumsden, and told him he was scared and revealed what had been said to him.
SPS PE instructor Mr Lumsden, 50, said he remembered Mr Kaizer coming into the office about a week before the assault on him but maintained he was complaining about something to do with dumbbells and gestured to the door but did not tell him who it was.
He said nothing had been said about violence, only that equipment had been taken off of him.
Lord Ericht said he found Mr Kaizer to be a credible and reliable witness and preferred his evidence to that of Mr Lumsden.
In the damages action, Mr Kaizer's lawyers maintained no complaint from him was recorded in a prison request book nor did Mr Lumsden submit any intelligence report.
Porter, 30, had a criminal record that a judge called "disturbing reading".
He had more than 30 previous convictions, many involving violence and four of which had a racial element.
Porter had admitted the attempted murder of another Polish national, Jaroslaw Janecek, in a horrific attack with a mop handle days before the gym assault of Mr Kaizer.
He received an extended sentence of 15 years for the previous murder bid.