Deputy Attorney General Rod Rosenstein officially submitted his letter of resignation today to President Donald Trump, bringing an end to his tumultuous two-year tenure at the Department of Justice. Though Rosenstein's exit has been in the works for some time—his replacement, Transportation Department official Jeffrey Rosen, has already been named—his exit still brought some surprises, as the former overseer of Robert Mueller's investigation used his letter to praise Trump, a man who's described Rosenstein as an “agent of Russia” and retweeted a photo of him behind bars.

In his resignation letter, Rosenstein said he was “grateful” to Trump for “the opportunity to serve; for the courtesy and humor you often display in our personal conversations; and for the goals you set in your inaugural address: patriotism, unity, safety, education, and prosperity, because ‘a nation exists to serve its citizens.’” The decision to single out Trump's “courtesy” comes even as the president frequently targeted Rosenstein as the leader of Mueller's so-called “WITCH HUNT” against the Trump campaign. Trump had blasted Rosenstein on Twitter as recently as February for “illegal and treasonous” acts with former acting F.B.I. director Andrew McCabe, after McCabe claimed on 60 Minutes that he and Rosenstein had discussed removing Trump from office via the 25th Amendment. (Rosenstein denies the allegations.)

The initial September New York Times report on Rosenstein's 25th Amendment speculation, which suggested Rosenstein had discussed wearing a wire around the president, sparked a wave of criticism against the deputy A.G. from the pro-Trump camp, including ramping up calls to impeach Rosenstein in the House. It also led many to believe Trump could fire Rosenstein, which reportedly moved the deputy A.G. to get “teary-eyed” before a meeting with Trump's chief of staff. (Rosenstein responded to the report during a speech Thursday, saying, “One silly question that I get from reporters is, ‘Is it true that you got angry and emotional a few times over the past few years?’ Heck yes! Didn’t you?”) Yet while Rosenstein responded in May to the House Republicans who tried to impeach him, saying the D.O.J. “is not going to be extorted,” Rosenstein's emotions never extended to him lashing out against his bully Trump. The Washington Post reported Friday that Rosenstein had instead tried to “mollify” Trump during the Mueller investigation and told him he would ensure Trump was treated fairly. “I give the investigation credibility,” Rosenstein reportedly said to Trump. “I can land the plane.”

Rosenstein may have managed to get some Trump criticism into his comments, though, as his letter ended with a discussion of the Department of Justice's “special responsibility to avoid partisanship,” noting, “political considerations may influence policy choices, but neutral principles must drive decisions about individual cases.” “We enforce the law without fear or favor because credible evidence is not partisan, and truth is not determined by opinion polls,” Rosenstein wrote. “We ignore fleeting distractions and focus our attention on the things that matter, because a republic that endures is not governed by the news cycle.” Much like the rest of his D.O.J. tenure, Rosenstein's comments walk a fine line between judicial independence and loyalty to those above him; they hit back against critics who suggest Attorney General William Barr's handling of the Mueller report was motivated by partisan biases, but also appear to rebuke Trump's frequent attacks on a Justice Department he felt was out to get him. Whether Rosenstein was really taking a dig at Trump or remaining ever-deferential to the head honchos, though, at least his exit was on his own terms. “I can go. I’m ready to go. I can resign,” Rosenstein reportedly said after the Times report in September. “But I don’t want to go out with a tweet.”

More Great Stories from Vanity Fair

— Cover story: Nicole Kidman reflects on her career, marriage, faith, and texting with Meryl Streep

— The investigations that could haunt Trump

— A mega-church pastor’s drug-running hustle

— Elizabeth Warren’s new approach: courting Game of Thrones fans?

— Why L.A. is ground zero for the next tech apocalypse

Looking for more? Sign up for our daily Hive newsletter and never miss a story.