WASHINGTON — Rod J. Rosenstein, a lifelong Republican with a tough-on-crime record, was eager to put his stamp on the Justice Department when he was sworn in as the deputy attorney general in the early months of the Trump administration.

Instead, he was abruptly thrust into a political maelstrom after President Trump fired James B. Comey as F.B.I. director only two weeks later. Mr. Rosenstein appointed a special counsel to investigate Russia’s election interference and spent the next year and a half defending that inquiry from both Mr. Trump’s unwavering attacks and attempted political intrusion by his congressional allies.

Now Mr. Rosenstein plans to step down as the United States’ No. 2 law enforcement official after Mr. Trump’s nominee for attorney general, William P. Barr, is confirmed, three administration officials said on Wednesday. Senators could vote to confirm him as early as next month.

Mr. Barr will represent a new chapter for the Justice Department and for the Russia investigation, which is nearing its final stages and is expected to be finished in the coming weeks or months, according to senior law enforcement officials. They cautioned that like any investigation, it could be prolonged if the special counsel overseeing the inquiry, Robert S. Mueller III, were to cover uncover new evidence central to his mandate.