Mr. McCabe has long said Mr. Trump’s public criticisms of him and his firing were meant to help discredit the special counsel’s investigation into Russian election interference and any role that the Trump campaign may have played in that activity.

The special counsel, Robert S. Mueller III, said in his report released this spring that Russia had interfered in the election to benefit Mr. Trump. He said there was not enough evidence to prove that the campaign itself had conspired in that effort, even though it was receptive to help from Russia. Mr. Mueller declined to weigh in on whether Mr. Trump had obstructed justice, saying only that he was unable to exonerate the president.

While the F.B.I. deems lack of candor to be a fireable offense, Mr. McCabe fought back against the recommendation that he be dismissed. The 21-year veteran of the F.B.I. appealed to senior career officials at the Justice Department, to no avail.

Mr. McCabe said in his filing that within weeks of Mr. Trump’s swearing-in, he became caught up in the president’s desire to protect himself from the Russia investigation at all costs, which included purging the Justice Department and the F.B.I. of officials perceived to be disloyal or to be Democrats.

After department officials were told that Mr. McCabe would soon be eligible to retire, Mr. Trump said on Twitter that Mr. McCabe was “racing the clock to retire with full benefits.”