Humberside Police were so concerned about the danger Allen posed to women that they built a world around him populated by police officers posing as his friends plus their girlfriends and family.
And this huge investment in Operation Misty paid dividends when Allen confessed to the murder of Samantha Class to an officer named in court only as Ian.
The recording of Allen’s confession to Ian was crucial when the Director of Public Prosecutions successfully applied to the Court of Appeal to quash the not guilty verdict reached by a jury in 2000.
It was also a central plank of the case which led to his eventual conviction.
The jury heard that Operation Misty began in 2010 when Allen returned to live in the Humberside Police area after being released from prison.
Allen was recorded in December 2010 telling Ian that a sex worker had threatened to report him for rape if he did not pay her “so I strangled her … and dumped her in the Humber”.
Prosecutors said this was the “clearest possible admission to the defendant’s guilt in murdering Samantha Class”.
In February 2011 Allen again referred to killing Ms Class, saying he “just went f****** mad”.
Detective Chief Inspector Christine Calvert, who led the recent investigation for Humberside Police, was not involved in the undercover operation a decade ago but said: “It would have been a huge decision.”
She added: “It was a two-year operation and they used seven different undercover officers.
“They all played varied parts in the operation.”
The senior detective said an officer called Scott was the first to befriend Allen when he moved into a nearby flat.
But it was later decided to bring in Ian to get closer by pretending to be an experienced offender on the run from other criminals.
Ms Calvert said: “There were others on the periphery, like girlfriends and family members, that were brought in to build up the story.”
She went on: “Gary Allen was a loner, so you had to be very dedicated.
“We obviously had highly-trained officers but they had to be really dedicated over a long period of time to keep that relationship going.”
She said Ian did “a fantastic job and deserves every commendation going”.
Asked why Humberside Police were so determined to put Allen behind bars despite his 2000 acquittal, Ms Calvert said: “I think it was the risk he posed to the public over that period of time.
“It was just getting justice, really, for the family. Samantha’s daughter was only 10 when it happened.
“All three of Samantha’s children have grown up without a mother and it was getting that justice for them, really.”
Ms Calvert said Ms Class’s daughter had spent more than 20 years wondering where Allen was and what he was doing.
“Now he’s behind bars and, hopefully, for the rest of his life or for a very long time, I think that will be a little bit of closure for her,” she said.
The detective added: “It’s a fantastic result.
“We’ve worked really hard over the last two years to try and bring Gary Allen to justice. He deserves to be brought to justice and he deserves to spend the rest of his life in prison.
“I think he’s a very dangerous man, especially to women. He’s got a deep-seated hatred of particularly sex workers.”