WASHINGTON — On William Barr’s first full day as attorney general, President Trump singled him out during remarks in the Rose Garden after signing a national emergency declaration aimed at building his long-promised border wall.

“I want to wish our attorney general great luck and speed, and enjoy your life. Bill, good luck,” Trump told him at Friday’s ceremony, drawing light laughter from others in attendance, who surely remembered the many ways the president tormented Barr’s predecessor, Jeff Sessions.

In the days that followed, Trump sent more than a dozen messages to his 58 million Twitter followers reviving his critiques of the Justice Department, which Barr now helms, or the officials who came before him. The president called the Russia investigation a “witch hunt” that is “totally conflicted, illegal and rigged!” He assailed former acting FBI Director Andrew McCabe as “disgraced.” And he said McCabe’s claim that Deputy Attorney General Rod Rosenstein broached the idea of using the 25th Amendment to oust Trump amounted to treason – while quoting a Fox News Channel pundit describing it as a “coup” attempt.

McCabe “and Rod Rosenstein, who was hired by Jeff Sessions (another beauty), look like they were planning a very illegal act, and got caught,” Trump tweeted Monday. “This was the illegal and treasonous ‘insurance policy’ in full action!”

Although Trump’s animosity was not aimed at Barr – in fact, he has praised him – it nonetheless puts the attorney general in a particularly awkward position as he begins his job.

Barr, people who know him say, is laboring to maintain his reputation as a relatively independent and principled leader while simultaneously reacting to pressure from his boss, who demands loyalty from his appointees and nominees and frequently disparages the Justice Department as it investigates his campaign and conduct.

“William Barr has been attorney general before, but no attorney general in our history – literally – has been under a president who has such contempt for the rule of law, the judicial process and law enforcement generally,” said Sen. Richard Blumenthal, D-Conn., a member of the Senate Judiciary Committee. “It’s: ‘Buckle in, because it’s going to be a wild ride, Mr. Barr. You ain’t seen nothing yet.'”

So far, Barr has kept a low profile, spending most of his time getting up to speed on how the department he led more than 25 years ago, in the George H.W. Bush administration, operates today.

He has not publicly addressed Trump’s running commentary of the past few days. But soon after he was confirmed by the Senate last week, he wrote in a memo to Justice Department employees that times have changed not just in the threats that federal law enforcement has to respond to, but in the microscope the department is now under.

“Advances in technology have given rise to new threats but also new tools to meet those threats, as well as new opportunities,” Barr wrote. “And the Department has faced ever-increasing scrutiny from all quarters as news cycles have shrunk from days, to hours, to nanoseconds.”