WASHINGTON — President Trump fired his acting attorney general on Monday night, removing her as the nation’s top law enforcement officer after she defiantly refused to defend his executive order closing the nation’s borders to refugees and people from predominantly Muslim countries.
In an escalating crisis for his 10-day-old administration, the president declared in a statement that Sally Q. Yates, who had served as deputy attorney general under President Barack Obama, had betrayed the administration by announcing that Justice Department lawyers would not defend Mr. Trump’s order against legal challenges.
The president replaced Ms. Yates with Dana J. Boente, the United States attorney for the Eastern District of Virginia, saying that he would serve as attorney general until Congress acts to confirm Senator Jeff Sessions of Alabama.
At 11:42 p.m., in his first act as the acting attorney general, Mr. Boente announced that he was rescinding Ms. Yates’s order.
Citing the earlier finding by the Justice Department’s Office of Legal Counsel that the immigration order was “lawful on its face and properly drafted,” he said that “I hereby rescind former Acting Attorney General Sally Q. Yates January 30, 2017, guidance and direct the men and women of the Department of Justice to do our sworn duty and to defend the lawful orders of our President.”
White House officials said that Mr. Boente was sworn in at 9 p.m., but it did not provide details about who performed the ceremony. In a statement, Mr. Boente pledged to “defend and enforce the laws of our country.”
At 9:15 p.m., Ms. Yates received a hand-delivered letter at the Justice Department that informed her that she was fired. Signed by John DeStefano, one of Mr. Trump’s White House aides, the letter informed Ms. Yates that “the president has removed you from the office of Deputy Attorney General of the United States.”
Two minutes later, the White House officials lashed out at Ms. Yates in a statement issued by Sean Spicer, the White House press secretary.
“Ms. Yates is an Obama administration appointee who is weak on borders and very weak on illegal immigration,” the statement said.
The firing of Ms. Yates came at the end of a turbulent three days that began on Friday with Mr. Trump’s signing of his executive order. The action stranded travelers around the world, led to protests around the country and created alarm inside the bureaucracy.
Ms. Yates, like other senior government officials, was caught by surprise by the executive order and agonized over the weekend about how to respond, two Justice Department officials involved in the weekend deliberations said. Ms. Yates considered resigning but said she told colleagues she did not want to leave it to her successor to face the same dilemma.
By Monday afternoon, Ms. Yates added to a deepening sense of anxiety in the nation’s capital by publicly confronting the president with a stinging challenge to his authority, laying bare a deep divide at the Justice Department, within the diplomatic corps and elsewhere in the government over the wisdom of his order.
“At present, I am not convinced that the defense of the executive order is consistent with these responsibilities, nor am I convinced that the executive order is lawful,” Ms. Yates wrote in a letter to Justice Department lawyers.
Mr. Trump’s senior aides huddled together in the West Wing to determine what to do.
They decided quickly that her insubordination could not stand, according to administration official familiar with the deliberations. Among the chief concerns was whether Mr. Sessions could be confirmed quickly by the Senate.
After Reince Priebus, the White House chief of staff, received reassurances from Senator Mitch McConnell of Kentucky, the Republican leader, that the confirmation was on track, aides took their recommendation to Mr. Trump in the White House residence.
The president decided quickly: She has to go, he told them.
The official statement from Mr. Spicer accused Ms. Yates of failing to fulfill her duty to defend a “legal order designed to protect the citizens of the United States” that had been approved by the Justice Department’s Office of Legal Counsel.
“It is time to get serious about protecting our country,” Mr. Spicer said in the statement. He accused Democrats of holding up the confirmation of Mr. Sessions for political reasons. “Calling for tougher vetting for individuals traveling from seven dangerous places is not extreme. It is reasonable and necessary to protect our country.”
Former Justice Department officials said the president’s action would send a deep shudder through an agency that was already on edge as officials anticipated an ideological overhaul once Mr. Session takes over. One former senior official said that department lawyers would be unnerved by the firing.
Democrats, meanwhile, hailed Ms. Yates as a principled defender of what she thought was right. Senator Chuck Schumer of New York, the Democratic leader, said in a statement that the “attorney general should be loyal and pledge fidelity to the law, not the White House. The fact that this administration doesn’t understand that is chilling.”
Mr. Boente has told the White House that he is willing to sign off on Mr. Trump’s executive order on refugees and immigration, according to Joshua Stueve, a spokesman for the United States attorney’s office in Alexandria, Va., where Mr. Boente has served as the top prosecutor since 2015.
Mr. Boente, who has been a prosecutor with the Justice Department for 31 years, had no hesitation about accepting the acting attorney general’s job given his “seniority and loyalty” to the department, Mr. Stueve said in a telephone interview on Monday night.
As acting attorney general, Ms. Yates was the only person at the Justice Department authorized to sign applications for foreign surveillance warrants. Administrations of both parties have interpreted surveillance laws as requiring foreign surveillance warrants be signed only by Senate-confirmed Justice Department officials. Mr. Boente was Senate-confirmed as United States attorney and, though the situation is unprecedented, the White House said he was authorized to sign the warrants.
Ms. Yates’s decision had effectively overruled a finding by the Justice Department’s Office of Legal Counsel, which had already approved the executive order “with respect to form and legality.”
Ms. Yates said her determination in deciding not to defend the order was broader, however, and included questions not only about the order’s lawfulness, but also whether it was a “wise or just” policy. She also alluded to unspecified statements the White House had made before signing the order, which she factored into her review.
Mr. Trump initially responded to the letter with a post on Twitter at 7:45 p.m., complaining that the Senate’s delay in confirming his Cabinet nominees had resulted in leaving Ms. Yates in place.
“The Democrats are delaying my cabinet picks for purely political reasons,” Mr. Trump said. “They have nothing going but to obstruct. Now have an Obama A.G.”
Ms. Yates’s letter transforms the confirmation of Mr. Trump’s attorney general nominee, Mr. Sessions, into a referendum on the immigration order. Action in the Senate could come as early as Tuesday.
The decision by the acting attorney general is a remarkable rebuke by a government official to a sitting president that recalls the dramatic “Saturday Night Massacre” in 1973, when President Richard M. Nixon fired his attorney general and deputy attorney general for refusing to dismiss the special prosecutor in the Watergate case.