A Strathclyde Police officer has denied lying to help his lover who was accused of a robbery.
Pc Steven Smith, 30, is alleged to have falsely told another officer that his partner, David Brydon, 34, denied any knowledge about a stolen wallet.
This is said to have resulted in the case being closed.
Pc Smith denies attempting to pervert the course of justice between February and March 2007 and another charge of misusing police data systems.
It is alleged that Pc Smith e-mailed Pc Pamela Grubb and told her that he had interviewed Mr Brydon at a Glasgow police station and that he knew nothing about the alleged theft.
Pc Smith told Glasgow Sheriff Court that he was telling the truth in the e-mail even, though he claimed he questioned Mr Brydon in his car while he was off-duty.
The police officer told the court that he met Mr Brydon at a gay night at the end of January in 2007.
He claimed that a few days later Mr Brydon told him that there was a warrant out for his arrest for driving offences and the officer told him to hand himself in.
Pc Smith told the court that Mr Brydon was jailed for three weeks but he regularly visited him and received phone calls from him.
Pc Smith, from Stepps, North Lanarkshire, also admitted writing several explicit love letters to Brydon.
Defence advocate Geoffrey Forbes asked: "Why, as a police officer, did you write to and visit David Brydon, given the circumstances?"
Pc Smith replied: "I truly believed that he wanted to be with me and wanted to get all these matters from his past sorted so we could be together."
The court heard that while Mr Brydon was in prison, the officer checked crime reports relating to his boyfriend on the police Crime Management System and noticed the outstanding theft matter.
Pc Smith claimed that he later questioned Mr Brydon about it when he came out of prison.
He said: "I told him that I had searched for the crime report and I put to him some questions regarding it."
Pc Smith claimed that he then e-mailed his colleague, telling her that Brydon knew nothing about it, because that is what he was told.
However, when asked why he wrote in the e-mail that Mr Brydon had been interviewed at Glasgow City Centre Police Office, he said: "I wrote that at that time because I knew that it wasn't a proper interview."
Prosecutor Lorna Revie asked Pc Smith if he was aware that under normal protocol he should have been on-duty and accompanied by another officer and he replied "yes".
She also asked if he should have cautioned Mr Brydon and noted down what he said and he replied "yes".
Miss Revie added: "You were putting your relationship above your duties as a police officer weren't you?"
Pc Smith replied: "No."
The officer admitted to the court that on one occasion he did carry out an unlawful database check on Mr Brydon because he was "curious to see what intelligence there was on him".
He also admitted accessing another system containing Mr Brydon's crime reports seven times but said that this was for "lawful police purposes".
The trial, before Sheriff John Bennett, continues.