Washington’s top ethics watchdog, who has repeatedly clashed with the Trump administration over conflicts of interest, is throwing in the towel early.

Walter Shaub, the director of the Office of Government Ethics, said on Thursday that he is resigning from his post effective July 19. While his five-year term would keep him in office until January, Shaub told The New York Times that “there isn’t much more I could accomplish at the Office of Government Ethics, given the current situation. O.G.E.’s recent experiences have made it clear that the ethics program needs to be strengthened.”

His resignation letter, which he posted on Twitter, did not go into why he was stepping down early. He did, however, spell out “the principle that public service is a public trust, requiring employees to place loyalty to the Constitution, the laws and ethical principles above private gain.”

Shaub’s role had been busier and far more controversial since November, when Donald Trump, a businessman with sprawling financial holdings, was elected. His job was further complicated when the president decided to retain those business interests, brought family members into his West Wing, and filled his inner circle and Cabinet with people who, like him, had webs of financial holdings that required thorough and consistent vetting to ensure there were not ethical violations or other conflicts of interest that might ensnare the executive branch.

Shaub, a modest career bureaucrat, quickly became the public face of a federal government that has privately rebelled against the Trump administration. A few weeks after the election, Shaub tweeted that Trump ought to divest from his business holdings. In January, after the then-president-elect declared he would not do so—instead letting his two sons mind the shop while he moved into the Oval Office and continued to profit from his business and personal holdings—Shaub said in a speech that Trump’s plan “doesn’t meet the standards that the best of his nominees are meeting and that every president in the past four decades has met.” A month later, he recommended that the White House discipline Kellyanne Conway for her comments on Fox News, in which she told viewers to buy items from Trump’s daughter and top West Wing adviser Ivanka Trump’s eponymous clothing line. The White House declined to do so, though the White House Counsel’s Office said it had gone over federal ethics guidelines with Conway.

Shaub’s office and the White House again tussled in April, when he publicly called on the administration to publish copies of waivers granted to White House appointees who had previously served as lobbyists or consultants. After a standoff, the White House relented, though Shaub found that a number of the waivers did not have the requisite signatures and dates.

Shaub, 46, told N.P.R. on Thursday that he is taking a position as a senior director for ethics at the Campaign Legal Center in Washington, a nonpartisan advocacy group that litigates voter-rights issues and promotes campaign finance reform. “At the Campaign Legal Center, I’ll have more freedom to push for reform,” he said. “I’ll also be broadening my focus to include ethics issues at all levels of government.”

His resignation leaves a crucial role unfilled, and presages what could likely become a politically charged battle over who might lead the Office of Government Ethics for the remainder of Trump’s time in office. Replacing Shaub requires Trump to nominate a candidate and receive Senate approval.