The first act of a drama that has shaken the Department of Justice ended Friday when a top official signed a formal request to drop corruption charges against New York’s mayor after Manhattan’s acting U.S. attorney refused to and resigned.

The official, Emil Bove III, had originally ordered Manhattan federal prosecutors who brought the case against Mayor Eric Adams to seek its dismissal. But the leader of the Manhattan office, Danielle R. Sassoon, resigned rather than obey, and she was followed out the door by at least six other prosecutors in New York and Washington.

Mr. Bove, whose order specified that the decision to dismiss the case had nothing do with its legal strengths, was ultimately compelled to sign the motion himself, along with two other Washington prosecutors, Edward Sullivan and Antoinette T. Bacon.

The reason he gave the judge was the same as he gave the New York prosecutors: that the prosecution would hinder Mr. Adams’s ability to cooperate with the Trump administration’s immigration policies. It was a highly unusual rationale for dismissing a criminal case, which is typically evaluated on the basis of the facts and the law. The abnormality was underscored by Mr. Bove’s difficulty in finding a prosecutor willing to affix a name to the filing.

Now attention will turn to Dale E. Ho, the judge who is overseeing the case in Manhattan federal court.

Mr. Adams was indicted last year on five counts, including bribery, fraud and soliciting illegal foreign campaign donations. He pleaded not guilty and was scheduled for trial in April. Ms. Sassoon, in a letter to the attorney general this week, said that prosecutors were prepared to bring an additional charge that would accuse him of destroying evidence and instructing others to do the same.

A lawyer for Mr. Adams, Alex Spiro, called that a false claim. He said that if prosecutors had proof that the mayor destroyed evidence “they would have brought those charges — as they continually threatened to do.”

Under the law, judges may question a prosecutor’s decision to seek a dismissal of charges, but they almost always grant such requests. Stephen Gillers, a legal ethics professor at New York University School of Law, said that Judge Ho could decide that the Adams case was the rare exception, that the government’s justification was inadequate.

Ordinarily it is the responsibility of the U.S. attorney whose office prosecutes a case to move for its dismissal. But Ms. Sassoon, 38, quit Thursday after telling the attorney general that she would not obey an order that had no valid basis.

In her letter to the attorney general, Pam Bondi, Ms. Sassoon characterized the order as a quid pro quo — dropping the charges in exchange for the mayor’s support of Mr. Trump’s political program.

“I cannot agree to seek a dismissal driven by improper considerations,” Ms. Sassoon wrote.

The Manhattan federal prosecutors who had been involved in Mr. Adams’s case sent a letter to Judge Ho on Friday evening indicating they were withdrawing.

They included Hagan Scotten, the lead prosecutor, who had already resigned from the Southern District in protest of Mr. Bove’s order.

In a scathing resignation letter, Mr. Scotten wrote that any federal prosecutor “would know that our laws and traditions do not allow using the prosecutorial power to influence other citizens, much less elected officials.”

He added: “If no lawyer within earshot of the president is willing to give him that advice, then I expect you will eventually find someone who is enough of a fool, or enough of a coward, to file your motion. But it was never going to be me.”

Three others also left the case: Celia V. Cohen, Andrew Rohrbach and Derek Wikstrom.

In his directive to Ms. Sassoon, Mr. Bove said that he had told the mayor’s lawyers that the government was not offering “to exchange dismissal of a criminal case for Adams’s assistance on immigration enforcement.” But on Thursday, hours after Ms. Sassoon quit, the mayor said he would allow federal immigration authorities to operate within the Rikers Island jail complex.

Ms. Sassoon said in court papers last month that there was “concrete evidence” of crimes by Mr. Adams, and that his claims that his prosecution was politically motivated were meant to divert attention “from the evidence of his guilt.”

For days, Manhattan prosecutors had been watching to see how Ms. Sassoon would handle the Justice Department’s directive to drop the charges; she and other top prosecutors had traveled to Washington recently to meet with department officials to discuss the issue in person.

The Trump administration last month elevated Ms. Sassoon, a veteran prosecutor, to head the U.S. attorney’s office for the Southern District of New York while President Trump’s choice for the post, Jay Clayton, awaited Senate confirmation.

In Mr. Bove’s letter accepting her resignation, he blasted her handling of the case and decision to disobey his order.

He told her that the prosecutors who had worked on the case against Mr. Adams were being placed on administrative leave too, and said they and Ms. Sassoon would be investigated by the attorney general and the Justice Department’s internal investigative arm.

Matthew Podolsky, who had been Ms. Sassoon’s deputy, is now the acting U.S. attorney.

The indictment against Mr. Adams was announced in September by the U.S. attorney who led the office during the Biden administration, Damian Williams. Mr. Adams, a Democrat, has claimed that he was targeted because of his criticism of the administration over the migrant crisis — an assertion the Southern District has rebutted, noting that the investigation began well before the mayor made those comments.

Mr. Adams has praised parts of Mr. Trump’s agenda, visited him near his Mar-a-Lago compound and attended his inauguration a few days later. Mr. Trump had floated the possibility of a pardon, and criticized Mr. Adams’s prosecution, saying the mayor had been “treated pretty unfairly.”