Deputy Attorney General Rod Rosenstein, who oversaw the special counsel investigation into Russian election interference, submitted his resignation to President Trump on Monday, saying he would leave the office in two weeks.

Rosenstein was expected to leave once the Mueller investigation came to its conclusion. In his resignation letter, Rosenstein thanked the president for the opportunity to serve, and issued a warning about allowing partisanship to influence prosecutorial decisions.

“Political considerations may influence policy choices, but neutral principles must drive decisions about individual cases,” Rosenstein wrote. “We enforce the law without fear or favor because credible evidence is not partisan, and truth is not determined by opinion polls.”

Rosenstein was battered with criticism, including from the White House, during his tenure as the no. 2 official in the Justice Department. He was faulted for authoring a memo critical of FBI director James Comey and his handling of the Hillary Clinton email server investigation, which was used to justify Comey’s firing in May 2017.

Rosenstein was in charge of Russia investigation, as Attorney General Jeff Sessions had recused himself. After Comey was fired, Rosenstein appointed Robert Mueller as special counsel to lead the investigation.

The deputy attorney general came under withering attack from Republicans on Capitol Hill, who accused him of withholding information from Congress and dragging out the investigation. Trump also attacked Rosenstein, accusing him on Twitter of engaging in a “very illegal act” with former acting FBI director Andrew McCabe. McCabe has said that Rosenstein offered to wear a wire in a meeting with Trump, which Rosenstein has denied.

Last month, Rosenstein joined with Attorney General William Barr in deciding that the special counsel’s report did not establish that Trump committed obstruction of justice.

In his resignation letter, Rosenstein praised Trump for the “courtesy and humor you often display in our personal conversations,” and cited the “goals you set in your inaugural address: patriotism, unity, safety, education and prosperity.”

“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,” he wrote. “We keep the faith, we follow the rules, and we always put America first.”