US Deputy Attorney General Rod Rosenstein has handed in his resignation to President Donald Trump.
The two men had a rocky relationship. In 2017, Mr Rosenstein appointed Special Counsel Robert Mueller to probe claims of Russian interference in the 2016 presidential election.
In a resignation letter, he wrote: “We enforce the law without fear or favour because credible evidence is not partisan.”
He will leave the post on 11 May.
Correspondents say Mr Rosenstein had been expected to resign in March, following the appointment of William Barr as attorney general.
However, he stayed in the job longer to help Mr Barr manage the public release of the special counsel’s findings from the investigation, which has dominated much of Mr Trump’s presidency so far.
Mr Trump has repeatedly called the investigation a “witch hunt”, although Mr Barr and Mr Rosenstein eventually cleared him of the obstruction of justice charge.
Why is their relationship so bad?
In 2017, Mr Rosenstein was left in charge of appointing someone to oversee the Russia investigation after Mr Trump fired then-FBI director James Comey.
Jeff Sessions, who was attorney general at the time, had already recused himself, meaning that his deputy had to take on the responsibility.
Mr Rosenstein then surprised the White House when he appointed Mr Mueller – an independent lawyer.
His relationship with the president became even more fractured last September, when the New York Times published a story claiming he had discussed ousting Mr Trump.
Citing anonymous sources, the paper said Mr Rosenstein had suggested secretly recording the president in order to prove he was dysfunctional, and had argued that it was permitted in line with the 25th amendment of the constitution.
That amendment allows for the removal of a president if he is deemed unfit for office.
Mr Rosenstein dismissed the claims as “inaccurate and factually incorrect”, and a source told the BBC at the time that the comment had been sarcastic.
But earlier this year, a TV interview given by ex-acting FBI chief Andrew McCabe inflamed tensions further. Mr McCabe repeated the claim about the plot to oust him, which led Mr Trump to attack both him and Mr Rosenstein as “treasonous”.
What does his resignation letter say?
In his letter, Mr Rosenstein praises some of what he calls the Department of Justice’s achievements and its employees’ “devotion to duty”.
“I am grateful to you for the opportunity to serve; for the courtesy and humour you often display in our personal conversations; and for the goals you set in your inaugural address: patriotism, unity, safety, education, and prosperity,” he adds, addressing the president directly.
“The Department of Justice pursues those goals while operating in accordance with the rule of law. The rule of law is the foundation of America. It secures our freedom, allows our citizens to flourish, and enables our nation to serve as a model of liberty and justice for all.”
He goes on to say that “truth is not determined by opinion polls”.
“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.”
In his conclusion, he echoes one of Mr Trump’s campaign slogans: “We keep the faith, we follow the rules, and we always put America first.”