Following this week’s midterm elections, President Trump ousted his attorney general, seized control of the Russia investigation for a partisan loyalist and suspended the credentials for a journalist he deemed too adversarial.

And that was just the first 24 hours.

After voters delivered a mixed verdict in the first national referendum of his presidency, Trump has been unbound, claiming more of a popular mandate than exists — “very close to a complete victory,” as he put it Wednesday — and moving swiftly to press some of the buttons he had previously resisted pressing.

“All of the guardrails are off and the rule of law is under an unprecedented threat,” said Joyce White Vance, who served as a U.S. attorney in Alabama during the Obama administration.

For more than a year, Trump has mused privately and publicly about his desire to remove Jeff Sessions because he believed the attorney general was disloyal by recusing himself from the Russia investigation due to conflicts of interest. But Trump’s advisers, including his personal attorney Rudolph W. Giuliani, counseled him against the firing — at least until after the midterm elections.

So on the day after the election, he did it.

Trump directed Sessions to resign and appointed as acting attorney general Matthew G. Whitaker, a Trump loyalist who has been publicly critical of special counsel Robert S. Mueller III’s investigation of Russian interference in the 2016 presidential election.

The move accomplishes another goal of Trump’s: transferring oversight of the Mueller investigation from Deputy Attorney General Rod J. Rosenstein, who is considered protective of the probe and has tangled with the president, to Whitaker, a Trump loyalist.

Congressional Democrats said the ouster of Sessions put the Russia probe in peril and invoked the specter of a constitutional crisis.

But Trump had groused about Sessions and upbraided him so frequently and for so long that the attorney general’s departure seemed inevitable. That may have been by design, Trump allies said, because the longer it felt inevitable, the more the shock factor wore off.

Consider the evolution of Sen. Lindsey O. Graham (R-S.C.). In summer 2017, he told reporters, “If Jeff Sessions is fired, there will be holy hell to pay.” But by summer 2018, Graham was telling reporters that it would be okay for Trump to remove Sessions because their relationship was beyond repair, though he cautioned that any replacement must allow Mueller to complete his investigation.

“It became a question of when, not if, and once something becomes inevitable it’s harder to be outraged about it,” said one former White House official, who spoke on the condition of anonymity to be candid. “Patience is not often an attribute attributed to Trump, but if he has to be, he can be very patient.”

It appears that Trump had the courage to finally fire Sessions — technically, the president directed the attorney general to resign through a message from the White House chief of staff — because the midterm elections were over and he felt validated by Republican victories in a number of the key Senate races in states where he campaigned.

The former official suggested part of Trump’s calculus may be that whatever political damage he suffers from ousting the attorney general could wear off before he faces reelection in 2020.

But Ari Fleischer, a former White House press secretary under former president George W. Bush, said, “I don’t attach any magic to Election Day.”

“Trump has always been impulsive,” Fleischer said. “He’s always taken abrupt action. He’s always been a from-the-gut, do-it-now executive, for better or worse. So I don’t attribute any strategy, any forethought, any detailed planning to any of it. I think this is Trump being Trump.”

In Tuesday’s midterm elections, Democrats took control of the House by sweeping suburban districts that had been represented by Republicans but where voters repudiated Trump. Republicans are poised to make small gains in the Senate, however, thanks in part to the president’s energetic campaigning in red states that he won overwhelmingly in 2016 and where he remains popular.

Trump tried to take a victory lap at news conference on Wednesday. When a reporter told him, “Last night was not an absolute victory for you,” the president said he saw it differently.

“I’ll be honest,” he replied, “I thought it was a very close to complete victory.”

As Fleischer put it, “Donald Trump is always in salesman mode. His marble countertops are the world’s best countertops. His lobbies are the most beautiful lobbies anywhere. His election nights are the most perfect election nights anybody’s ever had.”

Another decision that on the surface seemed impulsive was the one by the White House to suspend the press credential of CNN’s Jim Acosta after his testy exchange with Trump at the news conference.

But Trump has long vented angrily to aides about what he considers disrespectful behavior and impertinent questions and sought to punish them. He has singled out Acosta, as well as April Ryan of American Urban Radio, among others. As CNN’s chief White House correspondent, Acosta has long infuriated the president and his aides with his line of questioning and comportment.

Trump repeatedly has directed White House staff to ban individual reporters from covering official events or to revoke their press credentials. But Trump’s senior aides, including White House press secretary Sarah Sanders, had previously convinced him that moves to restrict media access could backfire.

That changed on Wednesday, when the White House for the first time directed the Secret Service to seize a reporter’s “hard pass,” which provides access to the White House grounds.

Sanders has defended the move and distributed a doctored video that made Acosta’s actions look more aggressive toward a White House intern. The deceptively edited footage was first shared by Paul Joseph Watson, who is known for his conspiracy-theory videos on the far-right website Infowars, which has been banned from Twitter and other social media platforms.

“This is a unique moment in this administration where the president has thrown down the gauntlet,” Vance said. “We have this dangerous convergence of walking away from the rule of law and walking away from the First Amendment at the same time.”

Michael D’Antonio, a Trump biographer who has studied the president’s behavior in his business and personal lives, said Trump’s moves this week to oust Sessions and punish Acosta are in keeping with his natural instinct to escalate feuds — and portend an even more tumultuous period of his presidency.

“His inclination is annihilation of the enemy,” D’Antonio said. “I think that he’s been dying to increase the power of his salvos against his enemies. He is a person who wants evermore powerful bombs to drop.”

That may explain a 12:38 a.m. tweet sent Thursday by Preet Bharara, who was fired by Trump as U.S. attorney in the Southern District of New York: “Why am I not sleeping?”