When Deputy Attorney General Rod Rosenstein appointed former FBI Director Robert S. Mueller III as special counsel to investigate possible collusion between the Trump campaign and Russia, he called on Washington’s consummate clean-up man.

A decorated Marine in the Vietnam War, Mueller has established an unmatched reputation in government and in the private sector as the guy you bring in when the situation is too politically toxic for anyone else. Last year, a federal judge appointed him to help settle more than 500 lawsuits against Volkswagen for its use of software to hide excess vehicle emissions. The NFL tasked him with writing a report about Baltimore Ravens football player Ray Rice’s assault of his then-fiancée in an elevator. And Booz Allen Hamilton, the former employer of National Security Agency whistleblower Edward Snowden, hired Mueller to conduct a review after another employee, Harold Martin, removed classified NSA information.

A former U.S. attorney in San Francisco, Mueller was appointed as FBI director a week before September 11, 2001. When Al Qaeda hijackers flew planes into buildings in New York and Washington, D.C., and crashed another in a field in Pennsylvania, Mueller headed the investigation of the largest crime scene in FBI history. At the same time, President George W. Bush gave his new FBI director a mandate: never another attack.

Mueller’s job was to transform the FBI overnight from an organization set up to investigate crimes after they occurred to one that could collect intelligence and prevent the next attack. The bureau Mueller took charge of was hardly equipped for the transformation. The FBI had just a handful of agents who could speak Arabic, and the most ambitious and talented agents viewed counterterrorism and counterintelligence as career dead ends.

Dale Watson, the counterterrorism section chief Mueller inherited, was once asked in a deposition if he knew the difference between Sunni and Shi’a Muslims. “Not technically, no,” Watson answered. When asked if he thought someone in his position should know the difference, Watson responded, “To some degree, yes.”

Watson was indicative of the FBI at the time. Mueller’s predecessor, Louis Freeh, was a Luddite who had resisted efforts to give FBI agents unfettered Internet access for investigative work. As a result, when the 9/11 attacks occurred, agents were forced to fax around photos of the suspected hijackers.

The Bush administration reorganized the government after 9/11, creating the Department of Homeland Security. But Mueller succeeded in pushing back on early proposals to split the FBI into a law enforcement agency and an intelligence agency. Mueller insisted that the FBI could be both, arguing that there were advantages to marrying law enforcement powers with counterterrorism, intelligence and counterintelligence mandates. He reshuffled the FBI and created a new executive assistant director position for intelligence, elevating the importance of intelligence and counterintelligence programs.

“I am committed to the closest possible cooperation with the intelligence community and other government agencies,” Mueller told Congress in 2003.