Penetrating insular, loyalty-based, testosterone-infused groups, like the Hells Angels, Massachusetts’ now-defunct Metropolitan Police department, the Mafia, and President Donald Trump’s network, requires a special kind of prosecutor. Someone who knows how to wield the carrot and stick in fair measure. Someone who hates the crime but not the criminal. Someone smart enough to know he doesn’t know it all and needs the help of an insider to unravel complicated and Hydra-headed conspiracies. A prosecutor like Robert Mueller, who has now spent 37 years, or nearly half his life, using the art of the plea deal to successfully crack open these insidious enterprises.

The court papers filed by the special counsel this week relating to Michael Flynn, Michael Cohen, and Paul Manafort are classic examples of these qualities in action. Mueller rewarded Flynn with the best possible carrot, a recommendation that he not be sent to jail because he provided firsthand knowledge of contacts between the Trump team and the Russians and had had, until he met Trump, an exemplary military and public service career. But the special counsel also pointed out that Flynn’s lifetime of public service required he be held to a higher standard.

Mueller was even more deft when dealing with Michael Cohen. While the U.S. Attorney in New York called Cohen greedy and privileged and a wearer of rose-colored glasses in the first few pages of his sentencing memo, he waited until Page 15 to describe Cohen’s cooperation as “forthright and credible,” arguably one of the most important things for the sentencing judge to know. Mueller, on the other hand, didn’t display a hint of personal animus in his memo, even though Cohen lied the first time he met with him. Instead, Mueller called the information Cohen provided “relevant and truthful,” and even-handedly recommended that whatever sentence the judge chose to impose for Cohen lying to Congress, it be served concurrently with his sentence on the New York indictment.

And when wielding the very big stick of revoking Manafort’s plea agreement, Mueller reported crisply and conscientiously only the content of Manafort’s lies, without even the hint of a sneer.

Was Mueller’s no-jail sentencing recommendation for Flynn a call to other witnesses to throw their lot in with him, rather than wait for the presidential pardons Trump periodically dangles? Was his swift rebuke to Manafort a warning to other witnesses who attempt to deceive him? Was his praise for Cohen’s almost-there cooperation an incentive for Cohen to try harder? You betcha.

Looking back at his career, Mueller appears to have always wielded the power of the plea agreement judiciously. And he appears to have always understood that in order to get substantial cooperation from defendants turned government witnesses, he had to earn their trust and promise them a substantial reward in return.

According to newspaper reports, as an assistant U.S. attorney in San Francisco in 1980, Mueller retried a gang of Hells Angels charged with narcotics and other serious crimes. Victim-witnesses called to testify at the first trial waffled or failed to appear, for fear they would be killed. Jurors expressed similar concerns. No one was surprised when the first trial jury hung. Mueller streamlined the case by narrowing the indictment, dismissing marginal defendants, and offering plea deals to a handful of defendants, with some agreeing to testify in the second trial. Things went well until a Hells Angel informant, who had been immunized before Mueller became involved, admitted to receiving almost $54,000 from the government before testifying. Defense lawyers moved to dismiss the case for government misconduct. The judge expressed doubts about the witness’ integrity. Mueller investigated and reported the Drug Enforcement Administration had made these payments over time after the witness entered the Witness Protection Program. The trial continued. Nonetheless, the second jury, upset by the stench created by what looked like tainted testimony, hung again.

A few years later, at the Boston U.S. attorney’s office, Mueller zealously rooted out widespread police corruption in a case known as exam scam. A group of rogue cops within Massachusetts’ Metropolitan Police, a state agency that functioned in and around Boston, was caught in a $1.5 million bank heist. Initially a state case, the local prosecutor granted one of the burglars, Sgt. Joseph Bangs, immunity in exchange for his testimony against his remaining crew. Bangs told local prosecutors about other thefts, narcotics sales, and other crimes this group had committed. But he also explained they had undermined the integrity of the entire Metropolitan Police department by stealing and selling the civil service exams given to help aspiring cops obtain promotions to supervisory roles within the police department. They charged $3,000 for these exams and answers, but the rogue cops weren’t doing this entirely for the money. They were blackmailing police brass at the highest levels with their cheating, Mueller argued, to make them ignore the pervasive corruption that was taking hold in the department.

Mueller didn’t have to ratify the immunity given to Bangs by the local DA, but he did and went one step further. He gave the kingpin, Gerald Clemente, what amounted to a no-jail plea deal in exchange for his testimony. Clemente already was serving a 30-year state sentence for the bank burglary, and some argued that the “no-jail” aspect of the agreement was meaningless. But what counted was that Mueller used Clemente to break the notorious blue line. He convinced a 20-year veteran to testify against his brethren. Literally. Clemente testified against his brother. All but one of the six defendants in the original exam scam trial were convicted. And Clemente was sentenced to 15 years, to be served concurrently with his outstanding sentence.

Mueller’s best-known plea bargain was the sweetheart deal given to Sammy “the Bull” Gravano, the underboss of the Gambino crime family, when Mueller was the chief of the Justice Department’s Criminal Division. Gravano, implicated in 19 murders and hundreds of other serious crimes, agreed to testify against his boss, John Gotti, and others, in exchange for pleading guilty to a single count of racketeering, carrying a maximum possible sentence of 20 years. Gravano, labeled by prosecutors as the “most significant witness in the history of organized crime in the United States,” was ultimately sentenced to five years, which essentially amounted to time served at the time of his sentencing. Prosecutors involved in the Gotti case credited Mueller with having the vision to promote such a controversial plea bargain.

The trust Mueller engenders makes him a formidable adversary. He goes to the mat for people who put their lives and careers on the line to tell the truth like Michael Flynn has done. He brings the full weight of the government down on double-crossers like Paul Manafort. And he expresses appreciation for truthful information he receives from defendants like Michael Cohen, not quite committed to joining Team America, but willing to help.

Mueller has proved to the people in Trump world who want to put their misdeeds behind them, and make a new Trump-free life, that he offers the only get-out-of-jail-free card that is guaranteed to work.