A man who has spent 17 years protesting his innocence over a knife murder has been cleared by appeal judges.
Stuart Gair said he was relieved but "absolutely shattered"
Stuart Gair, 42, had his conviction quashed after it was ruled he suffered a miscarriage of justice at his trial.
Lord Abernethy said a failure to disclose witness statements to his lawyers deprived the defence of a "powerful argument" on identification.
Mr Gair, who was found guilty of murdering Peter Smith after a trial in Glasgow in 1989, said he was relieved.
After a brief appearance at the Court of Criminal Appeal in Edinburgh, he added: "I am shattered, absolutely shattered. I am still shaking."
Mr Smith, of West Plean, in Stirlingshire, was stabbed to death in North Court Lane on 11 April, 1989.
Mr Gair denied committing the offence but was convicted by a majority verdict and sentenced to life imprisonment.
He was freed on bail in 2000.
His case was referred back to the appeal court by the Scottish Criminal Cases Review, which was set up to investigate alleged miscarriages of justice.
At his trial, Mr Gair put forward a defence of alibi. He maintained he was in another part of Glasgow at the time of the murder near toilets on St Vincent Place.
During the trial a witness, Brian Morrison, identified Mr Gair and his former co-accused as the men he saw come out of the toilets and go in the direction of North Court Lane.
But in previous statements to police he had given conflicting information.
He told officers: "I have to tell you that a lot of what I have already told the police is not the truth and I made up some of it to attract attention to myself."
Defence counsel Gordon Jackson QC argued that if this information had been available to his lawyers at the trial, Mr Morrison could have been cross-examined in such a way to show that the jury could not trust a word he said.
A note had been attached to Crown papers for the trial which said at one point he had signed himself into a psychiatric hospital.
It said: "Morrison and his vivid imagination certainly set the police off on the trail of a red herring initially."
Mr Jackson argued that all this information had been available to the Crown but the defence had none of it.
The Crown accepted before the appeal court that the four statements given by Mr Morrison should have been disclosed to the defence but argued that no miscarriage of justice resulted from the failure to do so.
Lord Abernethy, who heard the appeal with Lord Kingarth and Lord Sutherland, said: "Morrison was a very important witness even if not an essential one.
"In our opinion there is no doubt that all four of Morrison's police statements should have been disclosed to the defence.
"These statements showed that Morrison was prepared to tell lies, to fantasise and to change his account when it suited him."
The information that he had been a patient at Leverndale Hospital should also have been made available.
Lord Abernethy said: "In these circumstances we have come to the conclusion that the non-disclosure of these police statements and other information resulted in a miscarriage of justice."