FBI Director Christopher Wray said Tuesday that his chief of staff, James Rybicki, was leaving the bureau, a development that follows President Trump taking aim at other senior FBI officials who worked under the former director, James Comey.

Meanwhile, Department of Justice officials told Fox News on Tuesday that Dana Boente, the US Attorney in the Eastern District of Virginia who is also the acting head of the DOJ’s National Security division, has been selected to step in as the FBI’s next general counsel. James Baker, who had served as general counsel, was reassigned late last year.

Rybicki, who served in the same position under Comey and continued his role under Wray, came under scrutiny from Republicans in recent months over his role in the Hillary Clinton email investigation.

But federal law enforcement sources told Fox News that Rybicki was not fired. His departure, they said, has “been in the works for a while.”

"Jim Rybicki notified me last month that he will be leaving the FBI to accept an opportunity in the corporate sector,” Wray said in a statement. “While this is an exciting move for the whole Rybicki family, Jim will be dearly missed by the FBI family -- and by me personally.”

According to his FBI biography, Rybicki began his career at the Department of Justice in 2001 and has worked at the Office of Legislative Affairs, the Office of Intelligence Policy and Review, the Office of the Deputy Attorney General, the United States Attorney’s Office for the Eastern District of Virginia and the National Security Division.

“His many years of dedication to the bureau and DOJ, his level-headed judgment and earnest professionalism, and his steady good cheer have been an asset to us all and have contributed greatly to the safety and security of our nation," the FBI director said.

Wray said he has tapped attorney Zachary Harmon to replace Rybicki.

"Fortunately, I am pleased that Zachary Harmon has agreed to return to government service as our next chief of staff,” Wray said, mentioning how he has “worked closely together” with Harmon in the past.

Rybicki was involved in the drafting of Comey’s infamous statement exonerating Clinton in the email investigation before interviewing key witnesses, including Clinton herself – something Republicans have seized upon.

Clinton, the Democratic presidential nominee in 2016, was investigated by the FBI for using a private email address and server to handle classified information she was secretary of state. In July 2016, Comey famously called Clinton’s email arrangement “extremely careless,” though he decided against recommending criminal charges.

Wray was tapped as FBI director after the president fired Comey last year. Trump has repeatedly contended that some at the bureau have unfairly targeted him. His position has been bolstered by the revelation of anti-Trump text messages surfacing between FBI official Peter Strzok and colleague Lisa Page.

FBI’S STRZOK ALLEGEDLY DISMISSED MUELLER PROBE: ‘NO BIG THERE THERE’

Axios reported late Monday that Attorney General Jeff Sessions, urged by Trump, has been pressuring Wray to fire FBI Deputy Director Andrew McCabe.

Republicans have long questioned McCabe’s ties to the Democratic Party, considering his wife ran as a Democrat for a Virginia Senate seat in 2015.

The outlet reported that Wray threatened to resign if McCabe was fired. White House Counsel Don McGahn reportedly told Sessions it wasn't worth losing Wray over McCabe and risking another media firestorm like when Trump axed Comey last year.

Speaking to reporters on Tuesday, Trump said “let's see how it all works out" when he was asked if he had concerns about senior FBI leadership.

Trump has publicly taken aim at other top FBI officials, including McCabe, before.

“How can FBI Deputy Director Andrew McCabe, the man in charge, along with leakin’ James Comey, of the Phony Hillary Clinton investigation (including her 33,000 illegally deleted emails) be given $700,000 for wife’s campaign by Clinton Puppets during investigation?” Trump asked in a December tweet.

Fox News’ Adam Shaw contributed to this report.