Police paid a convicted child rapist almost £10,000 to spy on parties where they suspected under-age girls would be intoxicated and sexually abused, a court heard.
He was recruited despite being a sex offender who had drugged an under-age girl and invited another man to rape her after he had done so, a court heard.
Years later, the man, who can only be identified by the media as XY, was tasked by Northumbria Police to assist their investigation into child sexual exploitation in Newcastle.
Subsequent trials which followed Operation Shelter, until now unreportable, have heard girls were groomed by men who gave them cannabis, alcohol and the designer drug Mkat at parties, then encouraged into having sex.
The startling information about XY came out during pre-trial hearings at Newcastle Crown Court which attempted but failed to halt prosecutions against a number of men accused of a range of serious offences including drug dealing and sexually abusing girls.
During proceedings which can only now be reported, more than 20 prosecution and defence barristers in wigs were in court arguing whether the cases of more than 10 men should be thrown out.
Defending barristers argued that the public's confidence in the justice system would be undermined if the trials went ahead, given that the rapist XY had acted as an informant, formally known as a Covert Human Intelligence Source, or "CHIS".
Robin Patton, representing one of the defendants, said XY was paid £9,680 over 21 months by Northumbria Police for informing.
Mr Patton said XY was a "convicted child rapist who drugged a child and invited someone else to rape her after he had" and was subject to a suspended sentence when he was deployed by police in 2014.
Mr Patton said the confidence of the public in the administration of justice would be "substantially diminished" if they knew police had chosen "such an individual" to help their investigation into the exploitation and possible use of drugs by young people.
Mr Patton said police claimed they carried out a risk assessment, but that the "very next day" after he was recruited, XY was in court for a dishonesty offence.
After he was recruited, XY was arrested in September 2015 on suspicion of inciting sexual activity with a child after a teenage girl claimed a man approached her and made an indecent proposition.
The informant was later told he would face no action after he took part in an identity parade.
XY, who was on the Sex Offenders' Register, also failed to notify police he had moved house, Mr Patton said.
Mr Patton said: "I have tried to think of convictions that make him less suitable to act as a CHIS in an operation of this sort... I have not been able to."
David Hislop QC, representing another defendant, said XY had 13 previous convictions, including 26 offences of dishonesty.
During the legal submissions, XY gave evidence to the court and made a series of lurid allegations against the police, including claims of racism and that he was asked to plant drugs.
But Judge Penny Moreland rejected his evidence in its entirity, describing it as "inherently unreliable" and "clearly dishonest".
XY claimed he was recruited because he acted as an informal taxi driver for some of the defendants.
"I would get to know where they pick up their drugs, where the parties were," he said.
At another point, he claimed: "I was chilling with the boys. I had to make it look like I was their friend."
Giving evidence from behind a screen, and with the public gallery cleared, XY said he had been a paid informant for six or seven years.
He told the abuse of process hearing that police tasked him "to find out what was going on in the area, when parties were taking place, where there was criminal activity".
"There were certain individuals they were very interested in, which I was close to," he said.
Operation Shelter was part of a force-wide, bigger investigation known as Operation Sanctuary.
XY said: "When I worked for Sanctuary I actually believed I was doing good. I never, ever thought it was bad. I enjoyed it."
Police gave him a list of names, he said, "all Asian" and claimed a handler referred to "darkies".
During one trial at Newcastle Crown Court in 2015, he claimed he was encouraged by a police handler to listen in on private meetings between defendants and their legal representatives.
He claimed at one point to have discovered a barrister had a crucial DVD containing evidence, and when he mentioed it to his handlers he was given a "standing ovation".
As well as receiving money, police informants were given "texts" - secret letters that could be put before a judge if they were convicted of an offence to gain a more lenient sentence.
XY claimed he was told the text he would receive for the DVD information was "gold, silver, bronze... diamond" and that the text "comes from high up".
Judge Moreland turned down the abuse of process application, ordering that the trials of the defendants should not be thrown out.
She added: "I do not regard myself as bound to act on evidence which is so inherently unreliable, so lacking in credibility and in my view so clearly dishonest."
She also found that there was no evidence that XY was guilty of any sexual misconduct towards any complainants in the cases.
XY had told the court he went to one or two parties but left "because I knew what was coming, before it was coming".
It was understood XY did not give evidence in any of the Operation Sanctuary trials.
Jon Brown, of the NSPCC, said: "We are appalled to learn that police paid a child rapist and planted him in the midst of vulnerable young girls. You just couldn't make it up.
"It beggars belief that it would ever have been considered, let alone approved, and serious questions must be asked about the force's approach to child sexual exploitation operations.
"However good the force's intentions, their misguided actions run entirely counter to all current child protection procedures and what we know about sex offenders and could have compromised this investigation.
"What we mustn't forget in all this is the victims who were preyed on by a series of despicable men for their own sexual gratification. It is right that these men are now behind bars."
"Groomers trick young people into believing that they have chosen to be in this situation and will use them however they like for their own twisted pleasure. We want every child and young person to understand what sexual exploitation is, and know that it is categorically not their fault."
Northumbria Police Chief Constable Steve Ashman said in a statement: "We know concerns have been raised about our use of a police Informant known as XY.
"XY was an authorised covert human intelligence source (CHIS), an informant, who was able to report on criminality including CSE.
"He was a convicted rapist and to some of us the thought of the police engaging with such a person and paying them for information may appear repugnant, however he proved he was in a position whereby he could, and did, alert police to situations which allowed them to prevent offending and provide safeguarding measures towards potential victims.
"The lawful and regulated use of such tactics is always overseen by a senior police officer and is also subject to review by an independent body. Furthermore in this case the handling of XY by Northumbria Police was the subject of an independent investigation by the IPCC in which no misconduct was found nor any recommendations made whatsoever.
"In the case of XY it is clear that his relationships with others have allowed the police to prevent and detect some of the most serious crimes occurring in our communities, this would not have been possible through conventional methods."