WASHINGTON — In the three days after the Democrats captured the House, President Trump fired his attorney general and replaced him with a loyalist critical of both the courts and the Russia investigation. He banned a CNN correspondent from the White House, while threatening he would do the same to other journalists. And he accused election officials in Florida and Arizona of rigging the vote against candidates he had campaigned for.
It was a remarkable assault on the nation’s institutions, even by a president who has gleefully taken a hammer to the press, to judges and prosecutors he does not like, and to an electoral process he has denounced as fraudulent since the day he took office.
Mr. Trump’s actions suggested a president lashing out after a midterm election loss that he had initially cast as a victory. Now he is girding for battle with a newly empowered Democratic opposition — one armed with subpoena power and a long list of questions about his conduct in office and ties to Russia — and it has brought out a fresh aggressiveness in him.
While each of his actions rattled Washington, Mr. Trump’s appointment of Matthew G. Whitaker as the acting attorney general, replacing the ousted Jeff Sessions, raised the thorniest ethical and legal questions, according to lawyers and former Justice Department officials.
Mr. Whitaker’s radical legal views; public disparagement of the Russia investigation, which he now oversees; connections to a Florida company shut down after fraud allegations; and lack of Senate confirmation each make him a dubious choice to be the nation’s chief law enforcement officer.
Together, critics say, they make him a threat not just to the work of the special counsel, Robert S. Mueller III, but also to the rule of law more broadly.
“Whatever the right answer to the particular ethical and legal issues might be, we should not lose sight of the larger question of whether this is an effort to undermine the system of justice,” said Walter E. Dellinger III, who served as acting solicitor general in the Clinton administration.
Mr. Trump is not the first president to appoint an ally with thin credentials to run the Justice Department: John F. Kennedy picked his brother, Robert. Nor is it unusual to staff government agencies with officials who bring vested interests to the job. But Mr. Dellinger said there was no precedent for installing a political crony as attorney general at the very moment that he could decide the fate of a federal investigation involving the president.
Even Mr. Trump seemed to recognize the problematic nature of the appointment. On Friday, he told reporters he did not know Mr. Whitaker, the opposite of what he said on a Fox program only a month earlier, and he emphasized that Mr. Whitaker was serving on an acting basis.
Still, the president brushed aside questions about Mr. Whitaker that, to most legal experts, are fundamental: Should he be disqualified because he was not confirmed by the Senate? And should he recuse himself from the Russia case because of his demonstrated hostility to Mr. Mueller’s investigation?
“Matt Whitaker is a very smart man. He is a very respected man in the law enforcement community, very respected, at the top of the line,” Mr. Trump told reporters, adding: “You know, it’s a shame that no matter who I put in, they go after him. It’s very sad, I have to say.”
For the most part these days, Mr. Trump speaks less in sorrow than in anger. His vexed relations with the press have turned bitterly hostile, for example, and his list of grievances keeps getting longer.
Mr. Trump blacklisted Jim Acosta of CNN for ostensibly touching a female White House intern inappropriately during a news conference. When Yamiche Alcindor, a correspondent for PBS, asked him earlier in the session whether his inflammatory language emboldened white nationalists, he snapped, “That’s such a racist question.”
He also went after Abby Phillip, one of Mr. Acosta’s CNN colleagues, and April Ryan, a correspondent for American Urban Radio Networks, for asking questions he did not like.
All three are African-American women.
“What a stupid question that is,” Mr. Trump said to Ms. Phillip on Friday, when she asked him something that was on the minds of people all over Washington: Did he want Mr. Whitaker to rein in Mr. Mueller’s investigation? “I watch you a lot. You ask a lot of stupid questions.”
He warned that he might pull the credentials of other reporters who did not treat the presidency with appropriate respect — a step that no previous occupant of the office, even Richard M. Nixon, has taken.
“This is a very sacred place to me,” Mr. Trump said, standing on the South Lawn before he departed for a trip to Paris. Then he went on to deride Ms. Ryan, who was not among the reporters gathered there, as a “loser” who “doesn’t know what the hell she is doing.”
Similarly, Mr. Trump’s view of the midterm results has turned sharply negative. On Tuesday, he trumpeted Republican victories in several Senate races as defying the odds for a sitting president. By Friday, as the counting of late ballots continued and Democratic candidates in Florida and Arizona suddenly looked as if they might emerge on top, Mr. Trump blamed corrupt election officials for “finding” Democratic votes.
It was reminiscent of his accusations of vote rigging before the 2016 election, when polls predicted he would lose to Hillary Clinton, and widespread voter fraud after the election, when he said he won the popular vote “if you deduct the millions of people who voted illegally.”
Mr. Trump lightheartedly linked his allegations about the midterms to Russia’s interference in the 2016 election — something that other officials in his administration have portrayed as a corrosive threat to the integrity of American democracy.
“You mean they are just now finding votes in Florida and Georgia — but the Election was on Tuesday?” Mr. Trump tweeted from Air Force One on the way to Paris on Friday. “Let’s blame the Russians and demand an immediate apology from President Putin!”
He posted six more tweets about the alleged voter irregularities and vowed to send a battalion of lawyers to stop them.
The last time Mr. Trump promised to expose voter fraud, nothing much came of it. And his attacks on the news media have so far failed to prevent reporters from doing their jobs. But the president’s appointment of Mr. Whitaker, experts said, was a threat of a different order.
It demonstrates, they said, that Mr. Trump still views lawyers — even those at the top of the Justice Department — as advocates for his own interests.
Mr. Whitaker’s reservations about Marbury v. Madison, the landmark 1803 ruling that enshrines the Supreme Court’s right to review executive and legislative actions and declare them unconstitutional, could jeopardize the status of the judiciary as an equal branch of government, according to legal scholars.
To hold a view so far outside the legal mainstream, they said, raised questions about how Mr. Whitaker would handle momentous issues, like the role of the courts or the fate of the Mueller investigation. But it could also corrode the day-to-day work of the Justice Department, which affects millions of Americans.
“Attorneys general make decisions every day,” said John R. Schmidt, who served as associate attorney general during the Clinton administration. “To have someone there who isn’t really capable of making reliable decisions is not trivial for the Trump administration.”