WASHINGTON — Matthew G. Whitaker, the attorney general’s chief of staff, jockeyed over the last two months to replace his boss by forging a close relationship with the White House, where he was seen as a reliable political ally. On Wednesday, President Trump fired Jeff Sessions and named Mr. Whitaker acting attorney general, rewarding his loyalty.

Inside the Justice Department, senior officials, including Rod J. Rosenstein, the deputy attorney general, have viewed Mr. Whitaker with intense suspicion. Before his current job at the Justice Department, Mr. Whitaker, a former college football tight end, was openly hostile on television and social media toward the special counsel, Robert S. Mueller III, and was seen by department officials as a partisan and a White House spy.

The special counsel is leading the investigation into whether any of Mr. Trump’s associates conspired with Russia during 2016 election and whether the president tried to obstruct the inquiry. Now Mr. Whitaker will oversee Mr. Mueller’s investigation, prompting concerns that he could move swiftly to shut it down or hobble it, despite serious questions about his own potential conflicts in supervising it.

[Read more about how Mr. Sessions’s firing could affect the Russia investigation.]

In August 2017, Mr. Whitaker highlighted on Twitter a Philly.com opinion article with the headline “Note to Trump’s Lawyer: Do Not Cooperate With Mueller Lynch Mob.” In his tweet, Mr. Whitaker wrote that it was “worth a read.”