– Rod Rosenstein, the deputy attorney general, praised President Donald Trump last spring for backing the rule of law and commended the Constitution and American culture for protecting lawfulness. "I don't think there's any threat to the rule of law in America today," he said at a celebration of the concept.

Rosenstein left unmentioned that he and other senior leaders at the department and the FBI were enduring Trump's sustained attacks on law enforcement in both public and private. The president had demanded Rosenstein falsely claim responsibility for dismissing the bureau's director and had toyed with firing the attorney general, prompting Rosenstein and the Justice Department's No. 3 official to vow to quit if the termination happened.

The long-awaited report by the special counsel, Robert Mueller, released on Thursday painted a portrait of law enforcement leaders more fiercely under siege than previously known. They struggled to navigate Trump's apparent disregard for their mission through a mix of threats to resign, quiet defiance and capitulation to some presidential demands. While their willingness to stay quiet might have protected their institutions, it also helped empower Trump to continue his attacks.

Trump made good on some threats, forcing out Attorney General Jeff Sessions the day after the midterm elections in November. The third-ranking Justice Department official, Rachel Brand, left three months before Rosenstein's speech to become Walmart's top lawyer. Rosenstein is himself set to depart.

"The bad news is that the attacks were relentless, but the good news is that the department has a thin political layer and a strong tradition of professionalism," said Chuck Rosenberg, the former chief of staff to the FBI director fired by Trump, James Comey. "But to see it and to read about the president's behavior is deeply disturbing."

The president sought to undermine the Justice Department's leaders and thwart the Russia investigation from his first days in office.

His attacks on law enforcement were most vividly embodied in his treatment of Sessions. A top 2016 Trump campaign supporter, Sessions recused himself from election-related investigations, drawing Trump's ire. After the special counsel was appointed in May 2017, the president demanded Sessions' resignation, saying he wanted an attorney general who would harness the Justice Department's power to protect the presidency.

Sessions submitted his resignation, touching off a scramble among White House aides to keep the president from accepting it. While he let Sessions keep his job, Trump pocketed his resignation letter and set off fears within the White House that he would wield it to get what he wanted from law enforcement officials.

Seeking a loyal attorney general, Trump asked a White House aide about Brand, a George W. Bush administration veteran.

But the aide never reached out to Brand "because he was sensitive to the implications of that action and did not want to be involved in a chain of events associated with an effort to end the investigation or fire the special counsel," according to the report.

When Trump pushed Reince Priebus, the former White House chief of staff, to secure Sessions' resignation, Priebus warned the president that both Rosenstein and Brand would also resign, a scenario certain to plunge the Justice Department into crisis.

The president agreed to hold off on firing Sessions for a day, and eventually dropped his plan to oust him. Instead, he stepped up his public criticisms. The attacks became so pointed, harsh and relentless that Sessions prepared another resignation letter and carried it with him whenever he went to the White House, according to the report.

Sessions resisted multiple entreaties to reverse his recusal so he could oversee and curtail the Mueller inquiry; by the time the criminal investigation of him ended in March 2018, he could do little to get back in the president's graces.

After Trump fired Comey as the director of the FBI, setting off a storm of criticism, he asked Rosenstein to give a news conference and say that the firing had been his idea.

Rosenstein warned the president that the news conference was a bad idea "because if the press asked him, he would tell the truth," Mueller's investigators wrote.

Rosenstein proved to be deeply rattled in the days after Comey's firing. He discussed the possibility of invoking the 25th Amendment to remove Trump as president and suggested that he secretly record Trump in the Oval Office, according to people briefed on the events. Rosenstein denied their accounts.

When those revelations surfaced in news reports more than a year later, in September 2018, Rosenstein braced himself to be fired. But after meeting with Trump and his aides, Rosenstein held on to his job and oversaw the Mueller investigation through the end.

In February, he once again complimented Trump in a speech about the rule of law.

"I'm very confident that when we look back in the long run on this era of the Department of Justice," he said, "the president will deserve credit for the folks that he appointed to run the department."