A man who offered to change his court evidence for cash has been jailed for more than two years.
Alan Wright was to be a witness at a jury trial over allegations he had been assaulted.
He offered to change his story in return for money and the trial had to be called off when his actions came to light.
As a result, Wright, 45, of Nairn Path, Glenrothes, ended up in the dock at Dunfermline Sheriff Court, rather than the witness box.
Wright admitted on various occasions between September 8 and October 30 2017 at his home, knowing he was a Crown witness and complainer in a criminal prosecution on indictment, he sent online messages in which he offered to provide false evidence favourable to the accused in return for money and attempted to pervert the course of justice.
The messages were sent to the female partner of one of the accused people and to a second man who was facing charges.
Depute fiscal Nicola Henderson said Wright was to give evidence at a trial over allegations that he had been assaulted.
However, before the court case, Wright entered into online conversations with the partner of one of the accused.
These included a Facebook message asking: “Are you going to square me up to make sure your man is alright on Monday?”
She believed this was an attempt by Wright to obtain money, added the depute.
Later messages included: “It’s the deadline pal” and then, “Just going to tell the truth. You didn’t get back to me.”
The matter came to light in court before the scheduled trial.
Police later executed a search warrant at Wright’s home and seized his mobile phone. Wright told officers: “I ken what this is about. It’s them putting pressure on me.”
He claimed “three or four people” had approached him asking him to “twist the story about being stabbed”.
He then complained to police: “This is a complete misunderstanding. I think it’s completely wrong. It’s me who was attacked.”
Defence solicitor Iain McCafferty said his client was taking drugs at the time and not thinking straight as a result.
Sheriff Charles MacNair told Wright: “You pled guilty to an offence of attempting to pervert the course of justice by offering not to give evidence at a jury trial in exchange for money.
“That’s goes to the very root of our justice system. If evidence is up for sale the justice system is put to nought.”
He jailed Wright for 27 months.