A senior Justice Department ethics official concluded acting attorney general Matthew G. Whitaker should recuse from overseeing special counsel Robert S. Mueller III’s probe examining President Trump, but advisers to Whitaker recommended the opposite and he has no plans to step aside, people familiar with the matter said.

Earlier Thursday, a different official, who spoke on the condition of anonymity, said ethics officials had advised Whitaker need not step aside, only to retract that description of events hours later.

The advice to stay away from the Mueller probe underscores the high stakes and deep distrust — within Congress and in some corners of the Justice Department — surrounding Whitaker’s appointment as the nation’s top law enforcement official until the Senate votes on the nomination of William P. Barr to take the job.

Whitaker did not return messages seeking comment.

Late Thursday, the Justice Department formally notified Congress of Whitaker’s decision not to recuse, writing in a letter that while an ethics official felt he should do so to avoid to appearance of a conflict, that official could not identify a precedent for such a recusal.

Sen. Minority Leader Charles Schumer (D-N.Y.), in a statement, said Whitaker’s refusal to recuse “is an attack on the rule of law and the American justice system, but it is undoubtedly consistent with what President Trump wanted — an unethical yes-man who will do his bidding rather than do what’s right.”

Within days of the president’s announcement in early November that he had put Whitaker in the role on a temporary basis, Whitaker tapped a veteran U.S. attorney to become part of a four-person team of advisers on his new job, according to a senior Justice Department official. Their guidance included the question of whether Whitaker should recuse himself from Mueller’s investigation because of his past statements regarding that probe and because of his friendship with one of its witnesses, the official said.

Whitaker never asked Justice Department ethics officials for a formal recommendation, nor did he receive one, this official said.

However, after Whitaker met repeatedly with Justice Department ethics officials to discuss the facts and the issues under consideration, a senior ethics official told the group of advisers on Tuesday that it was a “close call” but that Whitaker should recuse himself to avoid the appearance of a conflict of interest, the official said. Whitaker was not present at that meeting, they said.

Those four advisers, however, disagreed with the ethics determination and recommended to Whitaker the next day not to recuse, saying there was no precedent for that, and doing so now could create a bad precedent for future attorneys general.

When Eric Holder became the attorney general in 2009, he decided to recuse himself from overseeing the investigation of former presidential candidate John Edwards to avoid the appearance of a conflict. Holder’s reasoning was that he had been part of Barack Obama’s vice-presidential search committee that considered Edwards. In that case, Holder did not consult Justice Department ethics officials before deciding to recuse.

The senior official who described the Whitaker discussions refused to identify the Justice Department employees involved. Rep. Jerrold Nadler (D-N.Y.), incoming chairman of the House Judiciary Committee, said in a statement that he was troubled by how the information was made public.

“It is simply unacceptable that we are learning about this guidance through leaks to the press instead of from the Acting Attorney General himself,” Nadler said.

Typically, ethics officials make recommendations that Justice Department employees are expected to follow, but the final decision on whether to recuse over an appearance of a conflict of interest was always Whitaker’s to make, according to past and current officials.

As the Justice Department’s top official, Whitaker had been nominally supervising Mueller and was recently notified in advance of a key guilty plea in the case. So far, Whitaker has not received any briefings on the Mueller investigation, but he may at some point, the senior Justice Department official said.

The back-and-forth inside the department points to the conflicting views and allegiances surrounding its leader during the Trump administration, at a time when the president has publicly attacked federal law enforcement.

Whitaker’s rejection of his department’s ethics advice is likely to spur renewed criticism from Democrats, who have challenged the legality of Trump’s appointment of Whitaker, a Justice Department staffer who had not been confirmed by the Senate. Trump forced out former attorney general Jeff Sessions on Nov. 7.

Sen. Mark R. Warner (D-Va.) said in a statement that Whitaker’s disregarding the opinion of a senior ethics official was “deeply alarming” and “only reinforces the probability that his antagonism toward the Mueller probe was the sole reason for his selection as Acting Attorney General in the first place.” Rep. Adam B. Schiff (D-Calif.) said in a tweet that the Justice Department’s ethics opinion should be shared with Congress, adding, “DOJ officials must avoid not only actual impropriety but the appearance of impropriety.”

Before coming to the Justice Department to serve as Sessions’s chief of staff, Whitaker was a TV legal commentator who wrote and spoke frequently about the Mueller probe — almost always in critical ways. He suggested, for example, on CNN that he could envision a scenario where Sessions was replaced and his successor “just reduces [Mueller’s] budget to so low that his investigation grinds to almost a halt.”

The ethics controversy surrounding Whitaker could also have consequences for his chosen successor, Barr.

Now in private practice, Barr has similarly made public comments that are skeptical of Mueller, and this week, the Senate Judiciary Committee released a memo he sent to the Justice Department criticizing the special counsel for a “fatally misconceived” legal theory of how Trump may have obstructed justice.

The document, first reported by the Wall Street Journal, is sure to intensify the fight over Barr’s confirmation. Sen. Dianne Feinstein (Calif.), the Senate Judiciary Committee’s top Democrat, said Thursday the memo was “very troubling” and that she would be asking questions about it. Democrats might try to force Barr’s recusal as a condition of confirming him, though Republicans will still control the Senate next year.

Two people familiar with the document said Barr made the decision to submit it on his own — not at the direction of the Justice Department or the White House. Deputy Attorney General Rod J. Rosenstein said Thursday that the memo “had no impact on our investigation.”

Whitaker’s comments were more prolific and more blunt. He wrote in a piece for CNN that Trump was “absolutely correct” to suggest Mueller would be crossing a red line by examining the finances of Trump and his family.

Speaking about the June 2016 encounter at Trump Tower — where Jared Kushner, Donald Trump Jr. and others met with a Russian lawyer promising dirt on Hillary Clinton — Whitaker said: “To suggest that there’s a conspiracy here, I mean, you would always take that meeting.”

An audio recording has circulated online in which Whitaker expresses doubt about any Russian interference in American politics.

“The left is trying to sow this theory that essentially Russians interfered with the U.S. election. Which has been proven false. They did not have any impact in the election,” he said.

Sessions had been recused from Mueller’s probe, which has examined possible coordination between the Trump campaign and the Kremlin, as well as possible obstruction of justice by the president, because Sessions was a part of the Trump’s campaign. That left Rosenstein, who appointed Mueller, in charge.

But when Trump fired Sessions, Whitaker took command of the Russia investigation. He intimated to associates that he had no intention of recusing. Sessions, after all, was fired in part because the president was frustrated he had stepped aside.

Democrats and others expressed alarm about Whitaker’s past views, fearful he might stifle Mueller’s work. The special counsel regulations call for Whitaker, as acting attorney general, to be notified of significant events in the probe and give him the ability to veto any step he considered “so inappropriate or unwarranted under established Departmental practices that it should not be pursued.” If he does that, though, he would be required to notify Congress at the end of the case.

Last month, the special counsel’s office notified Whitaker in advance that former Trump lawyer Michael Cohen was going to plead guilty to lying to Congress about a possible Trump business project in Moscow.

Asked about his role in the Mueller probe at a news conference Thursday, Rosenstein said, “We’ve continued to manage the investigation as we have in the past, and it’s being handled appropriately.”

Some legal analysts had dismissed Whitaker’s public comments about the Mueller probe as essentially uninformed speculation that probably would not force him to step aside. Whitaker did, though, have a relationship with Sam Clovis, a Trump campaign adviser who has testified before the grand jury in Mueller’s case.

In 2014, Whitaker chaired the campaign for Clovis when he ran as a Republican candidate for Iowa state treasurer. Clovis told The Washington Post that he still considered Whitaker a friend.

Tom Hamburger contributed to this report.