White House Counsel Don McGahn plans to leave the Trump administration after the upcoming confirmation vote for Supreme Court nominee Brett Kavanaugh, President Trump said Wednesday.

“White House Counsel Don McGahn will be leaving his position in the fall, shortly after the confirmation (hopefully) of Judge Brett Kavanaugh to the United States Supreme Court,” Trump tweeted. “I have worked with Don for a long time and truly appreciate his service!”

McGahn’s departure had been expected. Fox News reported earlier this summer that McGahn had expressed a desire to leave the White House, and he could be replaced by former George W. Bush aide Emmet Flood.

But the announcement caught at least one senior Republican by surprise. Senate Judiciary Committee Chairman Chuck Grassley urged Trump to keep his White House counsel on board.

"I hope it’s not true McGahn is leaving WhiteHouse Counsel. U can’t let that happen," Grassley, R-Iowa, tweeted.

McGahn served as Trump’s top campaign lawyer during the presidential campaign in 2016.

The announcement of his departure comes amid revelations McGahn extensively cooperated with Special Counsel Robert Mueller’s team probing Russia’s attempted interference in the 2016 election.

Trump has said he approved of McGahn’s cooperation, and his legal team has used the revelation that investigators spent more than 30 hours with McGahn to argue it’s time to wrap up the probe.

As first reported by The New York Times, McGahn's discussions with Mueller's team covered moments surrounding Trump’s decision to fire former FBI Director James Comey, and his reported preference that Attorney General Jeff Sessions oversee the investigation. Sessions ultimately recused himself.

John Dowd, Trump’s former lead outside attorney, told Fox News earlier this month that “Don McGahn was a very strong witness for the president.”

Fox News’ John Roberts contributed to this report.