Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — The head of the federal agency charged with overseeing government ethics announced Thursday he is resigning nearly six months before his term is set to expire.

Walter Shaub Jr., the director of the independent Office of Government Ethics, tweeted the resignation letter he sent to President Donald Trump, announcing his last day on the job would be July 19.

Shaub’s agency is charged with enforcing the often murky ethics laws in the era of Trump. He clashed with Trump and his advisers over issues ranging from how Trump has handled his business dealings as president to the way the Trump transition was handled and the promotion of Trump businesses from White House staff.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

“The White House accepts Mr. Shaub’s resignation and appreciates his service. The President will be nominating a successor in short order,” a White House official said in a statement.

Even before Trump took office, Shaub and his team sounded the alarm to potential violations. The OGE mimicked Trump’s Twitter style in following the 2016 election to urge him to divest from his business dealings.

.@realDonaldTrump OGE is delighted that you've decided to divest your businesses. Right decision! — U.S. OGE (@OfficeGovEthics) November 30, 2016

Shaub later spoke out against Trump’s decision to give his sons control of his businesses, denouncing the decision as “wholly inadequate.”

He was especially bothered by the administration’s decision not to discipline Trump aide Kellyanne Conway for endorsing Ivanka Trump’s merchandise during a television interview from the White House.

"I remain concerned about Ms. Conway's misuse of position," Shaub wrote the administration. "Not taking disciplinary action against a senior official under such circumstances risks undermining the ethics program."

“It’s clear that there isn’t more I could accomplish,” Shaub told the Washington Post in an interview about his tenure. Just after his resignation letter was released, the Campaign Legal Center announced Shaub would join as senior director of ethics.

“I have had the honor and privilege of serving the American public at the U.S. Office of Government Ethics under three presidents — George W. Bush, Barack Obama and Donald Trump,” Shaub said in a statement from the Campaign Legal Center. “In working with the current administration, it has become clear to me that we need improvements to the existing ethics program. I look forward to working toward that aim at Campaign Legal Center, as well as working on ethics reforms at all levels of government.”

Senate Minority Leader Chuck Schumer congratulated Shaub on a "stellar career" and said Democrats look forward to "thoroughly examining the President’s nominee for this Senate-confirmable position."

House Minority Leader Nancy Pelosi, D-Calif., however, struck a considerably more critical tone regarding Shaub's resignation, calling it a "sad consequence of the Trump Administration’s constant ethical breaches."

“The departure of Walter Shaub from the Office of Government Ethics deals a serious blow to the integrity of our government," she said, adding that the move "comes at a moment of crisis for the democratic process."