The man who killed Lynette White has been accused of lying about how she met her death.
Jeffrey Gafoor, 46, was jailed for life in 2003 for Ms White's murder in 1988.
Gafoor is now a prosecution witness in a trial at Swansea Crown Court in which ex-police officers deny conspiracy to pervert the course of justice. Two other people deny perjury.
The court heard Gafoor had now given a different account of how he had killed Ms White, a prostitute in Cardiff.
Three men, who became known as the Cardiff Three, were wrongly convicted of the docklands murder.
The prosecution claim that the former South Wales Police officers manufactured evidence that led to the convictions of Ms White's boyfriend and pimp Stephen Miller, Yusef Abdullahi - who has since died - and Tony Paris.
The men were convicted in 1990 of the murder but released from jail two years later by the Court of Appeal.
Gregg Bull QC, representing retired chief inspector Thomas Page, told the court Gafoor was either lying previously or lying now about how Ms White met her death.
Gafoor, who worked as a security guard, said he could not explain why he had provided different accounts previously but he was now telling the "absolute truth" about what happened on 14 February, 1988.
Mr Bull said Gafoor now said he had taken a hunting knife to the flat in James Street, Cardiff, where Ms White used to entertain clients.
The jury heard that after Gafoor's arrest in 2003, he had told his solicitor that Ms White had produced the knife and he had taken it off her.
He had told the court she had not left the bedroom but he said in 2003 she went into the kitchen.
Gafoor said he had injured himself with his own knife as Ms White struggled during the stabbing, while in 2003 he had said he had received the injuries while taking the knife from her.
He also had told police he had hurt his hands at work and not during the murder, the court heard.
He accused Gafoor of using his apparent poor memory as a "convenient shutter to hide the truth".
Gafoor had previously said he met Ms White "for her services as a prostitute but I changed my mind and asked for my money back".
He said he had grasped for a knife to threaten her to get his money back and, in the course of an argument, he stabbed her.
Mr Bull said Gafoor had told his solicitor that the real reason he had demanded his money back was because Ms White refused to have unprotected sex for £30.
Earlier, William Coker QC, representing former chief inspector Graham Mouncher, asked Gafoor if he had been threatened, or promised anything, to take full and sole responsibility for Ms White's death.
Gafoor said he had not, and that he had told the court the truth to the best of his ability.
Previously, Gafoor told the court he felt "terrible" that three men were convicted of the murder in 1990 when "I was the one who killed Lynette White".
The trial continues.