“As was the case in prior transitions, many of the United States Attorneys nominated by the previous administration already have left the Department of Justice,” she said in the email. “The Attorney General has now asked the remaining 46 presidentially appointed U.S. Attorneys to tender their resignations in order to ensure a uniform transition.”

The abrupt order came after two weeks of increasing calls from Mr. Trump’s allies outside the government to oust appointees from President Barack Obama’s administration. Mr. Trump has been angered by a series of reports based on leaked information from a sprawling bureaucracy, as well as from his own West Wing.

Several officials said the firings had been planned before Friday.

But the calls from the acting deputy attorney general arose a day after Sean Hannity, the Fox News commentator who is a strong supporter of President Trump, said on his evening show that Mr. Trump needed to “purge” Obama holdovers from the federal government. Mr. Hannity portrayed them as “saboteurs” from the “deep state” who were leaking secrets to hurt Mr. Trump. It also came the same week that government watchdogs wrote to Mr. Bharara and urged him to investigate whether Mr. Trump had violated the emoluments clause of the Constitution, which bars federal officials from taking payments from foreign governments.

In Mr. Hannity’s monologue, he highlighted the fact that the Clinton administration had told all 93 United States attorneys to resign soon after he took office in 1993, and that “nobody blinked an eye,” but he said it became a scandal when the George W. Bush administration fired several top prosecutors midway through his second term.

Several Democratic members of Congress said they only heard that the United States attorneys from their states were being immediately let go shortly before the Friday afternoon statement from the Justice Department. One senator, speaking on the condition of anonymity to protect the identity of the United States attorney in that state, said that an Obama-appointed prosecutor had been instructed to vacate the office by the end of the day.