A key Trump administration official formally resigned Wednesday, concluding a 21-month tenure in which he played a key role in some of the president’s most significant accomplishments, a White House official confirmed to The Associated Press.

Don McGahn, 50, served as White House counsel to President Donald Trump and was seen as instrumental in implementing the administration’s conservative policies.

Yet McGahn’s role in the White House was complicated by his being a chief witness in Special Counsel Robert S. Mueller’s investigation into possible obstruction of justice.

McGahn reportedly told officials he was responsible for curbing the president’s more excessive measures, including his desire to fire Mueller from the investigation and reinstating Attorney General Jeff Sessions, The New York Times reported.

News of McGahn’s departure was first reported by Fox News earlier this summer after he expressed his desire to leave the White House. Trump tweeted in August that McGahn would be stepping down after Brett Kavanaugh was confirmed to the Supreme Court.

The two men reportedly had a final farewell chat on Wednesday.

TRUMP CONSIDERING DC ATTORNEY PAT CIPOLLONE FOR WHITE HOUSE COUNSEL

The president told The Associated Press that Washington lawyer Pat Cipollone will be his new counsel.

Should Democrats retake the House of Representatives, the White House counsel would bear the brunt of congressional subpoenas and investigations, according to The Times.

The Associated Press contributed to this report.