The White House promptly accepted Mr. Shaubâs resignation, and Lindsay E. Walters, a White House spokeswoman, said in a statement that the administration âappreciates his service.â Mr. Trump, she said, would nominate a successor âin short order.â
By departing ahead of schedule, Mr. Shaub handed Mr. Trump an opportunity to begin putting his mark on the agency overseeing the federal governmentâs vast ethics program, including that of the White House. The officeâs director has traditionally had wide latitude to set its priorities, its tone in working with the White House and other federal agencies, and, perhaps most important, how to interpret the countryâs ethics laws.
The vacancy is all but certain to frighten Democrats and those in the small world of government ethics who see the office under Mr. Shaub as an important political bulwark against conflicts of interest in the upper echelons of the government. To Mr. Trumpâs defenders, who have seen Mr. Shaub, an Obama appointee, as politically motivated, it is more welcome news.
The intensity of feeling over what is usually an obscure job speaks to the central role ethics have come to play in Mr. Trumpâs Washington, where the vast holdings of the president and his cabinet, as well as an influx of advisers from businesses and lobbying firms, have raised a rash of accusations of conflicts of interest.
It is the job of the ethics office, a creation of a post-Watergate Congress, to work with a web of ethics officials at each agency to help people entering the government sidestep potential conflicts. The office guides each administrationâs political appointees through financial disclosure requirements and creates agreements to restrict participation in deliberations over topics they handled for paying clients.
Mr. Shaub, 46, had faced an uncertain future at the agency since Mr. Trump took office in January. In the weeks between the presidentâs unexpected election victory and his inauguration, Mr. Shaub took an extraordinary gamble: He recommended very publicly on Twitter, and in a rare public speech, that Mr. Trump liquidate his vast business and personal holdings. This arrangement, Mr. Shaub argued, was the only truly ethical option.
Mr. Trump did not heed his advice, and by the middle of January, Mr. Shaub thought he might be fired. To minimize his attachment to the position, he packed up the personal possessions that filled his office.
But he was not fired, even as he continued to spar with Mr. Trumpâs aides over a range of ethical concerns, including the ethics officeâs authority to exercise oversight of the White House.
In February, he recommended that the White House discipline Kellyanne Conway, a top adviser to the president, after she made an on-air endorsement of the clothing line of Ivanka Trump, the presidentâs daughter. The White House Counselâs Office disagreed and took no disciplinary action.
More recently, Mr. Shaub and the administration fought over a routine request by the ethics office for copies of waivers issued to White House appointees to work in the Trump administration. The Office of Management and Budget initially balked at the request, challenging Mr. Shaubâs legal authority even to ask for the information and asking him to withdraw it. After Mr. Shaub fired back with a stern 10-page letter rebutting the argument, the White House backed down.
The White House eventually released the waivers, which showed that it had granted at least a dozen exemptions for aides to work on policy matters they had handled as lobbyists or to engage with former colleagues in private-sector jobs. Mr. Shaub objected to the fact that many of the waivers were undated and unsigned, and that some approved actions retroactively.
Mr. Shaub, who served for about a decade as a career civil servant at the agency before being appointed director, said his role had always been politically neutral. He says he has not been fighting Mr. Trump, as some critics have suggested, but that, rather, his decisions to speak out have been motivated by a desire to defend an ethics program that has traditionally counted on support from Democrats and Republicans alike. He said he spoke publicly only after more traditional channels were exhausted.
Mr. Shaub has continued to make a case for his line of reasoning. In an interview on Thursday with CBS News, he said Mr. Trumpâs decision not to liquidate his assets meant there was now âan appearanceâ that his businesses were profiting from the presidency.
âYou canât be sure,â Mr. Shaub said. âAmerica should have the right to know what the motivations of its leaders are, and they need to know that financial interests â personal financial interests â arenât among them.â
Mr. Shaub will leave the agency this month to take up his new position as a senior director for ethics at the Campaign Legal Center in Washington, a nonpartisan group that advocates campaign finance reform and litigates voting rights cases. There, he will have more freedom to comment on the governmentâs ethics program and to propose a set of changes he said were needed badly.
News of Mr. Shaubâs departure was greeted on Thursday with more acquiescence than surprise. Those who have worked in the ethics office or in the White House said it raised pressing questions over whether Mr. Trumpâs choice of Mr. Shaubâs successor would quiet the agencyâs criticism.
âI donât think anyone who comes after Walter is going to challenge the White House publicly the way that I think he did,â said Richard W. Painter, who served as ethics counsel for the George W. Bush White House. âIt is a great loss.â
Mr. Painter said the administration would do itself a favor by naming a successor with experience in ethics law and a reputation for independence.
A permanent replacement for Mr. Shaub would require confirmation in the Senate, where Democrats would probably use confirmation hearings to raise grievances about what they see as Mr. Trumpâs potential conflicts of interest, and Republicans are unlikely to act as a rubber stamp.
The White House could also elect to leave the position to an acting director indefinitely. Shelley K. Finlayson, the officeâs chief of staff, is first in line for the acting director position, but the law governing such vacancies also allows the White House to choose from among the officeâs upper ranks.
That arrangement, experts said, could help preserve the office and allow it to go about much of its work. Or it could simply be a quieter way to neutralize it, said Marilyn L. Glynn, who served as the agencyâs acting director during the Bush administration.
âBased on my experience as acting director, you clearly donât have the visibility and power that a full director would have,â Ms. Glynn said. âThat is one way of keeping the office fully below the radar.â