Police secretly recorded an alleged go-between for a corrupt Crown prosecutor setting up a deal to drop a guilty man's case, a jury heard today.
An undercover officer posing as a wealthy businessman paid £20,000 to get an assault charge dropped in its early stages.
Safraz Ibrahim, 51, of Cyncoed, Cardiff, admitted corruption on the eve of standing trial at Swansea Crown Court.
Ibrahim, Gwent Crown Prosecution Service (CPS) trials unit chief, also admitted attempting to pervert the course of justice and misconduct in public office.
As a senior prosecuting lawyer he used his power to review official files to discontinue a case against a man he believed guilty.
But the case was part of an elaborate police sting operation set up after fears over Ibrahim's dishonesty surfaced.
Co-defendant Saifur Rahman Khan, 37, of Penlan, Cardiff, went on trial at Swansea yesterday claiming police manipulated him into helping Ibrahim.
Jonathan Laidlaw QC told the jury about Ibrahim's guilty pleas when he opened his case yesterday.
Khan denies charges of corruption, attempting to pervert the course of justice and aiding and abetting Ibrahim's misconduct.
The offences all relate to a four-month period between May and August last year.
Conversations with Khan secretly recorded on the phone and in person were played to the jury today.
Officers with the Serious Organised Crime Agency (SOCA) targeted Khan as a means of testing his and Ibrahim's honesty.
An undercover officer posing as a businessman called Tariq approached Khan looking for a rental property for his driver.
Khan, who ran his own Cardiff-based property letting agency, first met Tariq when he arrived at his office in a luxury Bentley.
His driver was another undercover officer using the name Nick Baker who moved into a flat paid for by his apparent boss.
He was later arrested in a dramatic mock set piece which saw police burst into his flat and arrest him for assault.
It led to the creation of a bogus case file which Ibrahim was later to discontinue for a £20,000 bribe allegedly split with Khan.
The jury listened to recordings of Khan today in one of which he was heard to tell Tariq that Baker "would owe you big time for this because it (his case file) is going to be wiped clean".
In another conversation Khan talks about complications in discontinuing the case.
The jury was told that a bogus witness to the assault - that Baker openly tells Khan he committed - made discontinuing it difficult.
Tariq is also heard pushing several times to meet personally with Ibrahim but Khan, who refers to him as a friend, repeatedly declines.
When the case is apparently successfully discontinued Khan calls up Tariq, and says: "It is good news for you. It is all done."
Describing his own role Khan is heard to say: "I have been doing my best and working. It was very very difficult in all honesty. I will explain it to you when I see you."
In early August, Khan and the two undercover officers meet to celebrate at the Hilton Hotel in Cardiff.
Recordings of their conversations catch Khan passing on a warning from Ibrahim to both men about never speaking of the case.
Khan says that if they are caught Ibrahim told him that "All of us would be in (prison) for a very very long time. This is not Pakistan, this is Britain."
Previously the jury has heard that Ibrahim, who earned £70,000 a year with the CPS, had spiralling debts totalling £927,000.
Secretly recorded conversations played to the court today revealed Khan saying he had "mortgaged his properties to the hilt" and owed almost £650,000.
The case continues.