White House counsel Don McGahn is resigning this autumn after a tumultuous stretch as President Trump's in-house lawyer.

Trump announced the departure on Twitter on Wednesday morning.

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. I have worked with Don for a long time and truly appreciate his service!

One likely candidate to replace McGahn is Emmet Flood, who joined the president's legal team in May to focus on the Justice Department's Russia investigation.

White House press secretary Sarah Sanders said on Wednesday morning that Trump likes McGahn and that they have a "good relationship. There's not really a lot to add here."

Another person close to the White House, however, who asked not to be identified, said that Trump couldn't stand McGahn and openly complained about him to other White House aides.

Flood was brought in to serve as McGahn's successor and that transition might already have happened but for Supreme Court Justice Anthony Kennedy's retirement, the person said. McGahn convinced Trump to let him stay on to manage the process of selecting and then helping confirm a replacement.

Of Flood, Sanders said, "People like him. He's super-well-respected around the building, but there's not a plan locked in place at this point. He hasn't been offered. That's not where we are. So we'll keep you posted on a personnel announcement."

The person close to the White House told NPR that Flood makes good sense to take over as White House counsel in view of the ongoing Justice Department investigation.

"Emmet has the skill set. He's handled these things before," the source said — but added that with Trump, nothing is a done deal until it is done. The president is likely hearing from outside advisers who may try to convince him to choose someone else.

It wasn't clear on Wednesday whether that might mean Flood would step down too if he is passed over or whether he might stay within the administration in a subsidiary role to another new White House counsel.

The news about McGahn's resignation disappointed at least one important stakeholder outside the White House: Iowa Sen. Chuck Grassley, the Republican chairman of the Senate Judiciary Committee.

A spokesman for Grassley later issued a statement to NPR softening his position.

"Senator Grassley has appreciated Mr. McGahn's work over the last two years and has considered him integral to the president's record-breaking success on filling judicial vacancies," he said. "From Senator Grassley's perspective, there's not been any White House Counsel who has worked so well and so efficiently with the chairman's office and the Senate Judiciary Committee on judges."

Ticking clock

Indications about McGahn's departure had been growing recently and his days appeared numbered after a New York Times report detailed McGahn's extensive cooperation with special counsel Robert Mueller's investigation into obstruction of justice and possible collusion between the Trump campaign and Russia.

According to the report, McGahn spoke with Mueller's team about some of the key events of concern to the Russia inquiry, including Trump's firing of FBI Director James Comey, his push for Attorney General Jeff Sessions to take over the investigation from Mueller and his attempts to fire the special counsel.

The story sparked a series of angry tweets from Trump, saying he encouraged McGahn to cooperate with Mueller. But Trump's personal lawyer, Rudy Giuliani, appeared to know little about what McGahn said in his approximately 30 hours of interviews.

Giuliani told NPR on Wednesday that McGahn's departure doesn't have anything to do with his interviews with Mueller's investigators since the president had known about them for months.

Important insider

McGahn drew criticism early on in the Trump administration for poorly crafted executive orders, which in some cases were struck down by the courts. But the White House lawyer has left a lasting mark on the federal judiciary, spearheading the president's successful push to pack the bench with conservative judges.

McGahn, a combative former member of the Federal Election Commission, served as Trump's campaign lawyer. After Supreme Court Justice Antonin Scalia died in 2016, McGahn, along with the conservative Federalist Society,drew up a list of conservative judges from which Trump promised, if elected, to choose Scalia's successor.

The White House pulled out that list of judges again in June when Supreme Court Justice Kennedy announced his retirement. McGahn has ushered Trump's replacement pick, Judge Brett Kavanaugh, through meetings with senators before his September nomination hearings.

Kavanaugh is expected to be confirmed and on the high court in time for its October term. It is not clear precisely when, but between now and then, McGahn will depart the White House.

Senate Majority Leader Mitch McConnell, R-Ky., told Time magazine the list of possible judges was a key selling point for a lot of social conservatives, "given [Trump's] own background, which was far from, shall I say, ideologically consistent."

It was McConnell, of course, who preserved a vacancy on the high court by blocking a Senate vote on President Barack Obama's nominee to replace Scalia, Merrick Garland. McConnell used similar tactics to hold dozens of seats open on the lower courts.

As a result, Trump found more than twice as many vacant federal judgeships when he entered the White House as Obama had. He promptly set about filling them, with McGahn's help.

McConnell lamented McGahn's resignation in a statement on Wednesday, calling it "sad news for our country." McGahn's "significance to the judiciary, the White House and the nation cannot be overstated," McConnell said.

The White House counsel ran a clearinghouse for nominees, fielding suggestions from local lawyers and politicians as well as conservative advocacy groups like the Federalist Society and the Heritage Foundation.

Trump nominated Neil Gorsuch to replace Scalia during his second week in office. In addition, the president has so far installed 26 appeals court judges and 33 district judges. Dozens of additional nominations are pending.

A few of the nominees hit roadblocks. Matthew Petersen withdrew his nomination after questioning by Sen. John Kennedy, R-La., revealed an embarrassing lack of basic legal knowledge. Others were tripped up by inflammatory past statements.

But McGahn wasn't looking for inoffensive middle-of-the-road judges. As Time magazine reported, he told the Federalist Society last November that he wanted judges who were "too hot for prime time ... The kind of people that make some people nervous."

That unconventional style drew criticism in other areas, including McGahn's own legal work for the president.

"McGahn is reportedly 'an iconoclast bent on shaking things up,' " Jack Goldsmith wrote on the Lawfare blog early in McGahn's tenure. "Unfortunately for the president, that is not an attractive quality in a White House counsel, whose main job is to ensure that the president and the White House steer clear of legal and ethical and related political problems."

Early versions of the president's travel ban, on people from several mainly Muslim countries, were struck down by the courts. Judges also blocked an executive order that aimed to punish so-called "sanctuary cities."

McGahn was also warned just days into the Trump presidency about concerns surrounding the president's first national security adviser, Michael Flynn.

Acting Attorney General Sally Yates informed McGahn less than a week after the inauguration that Flynn had misled the vice president and other administration colleagues about his contacts with Russian officials.

There are conflicting accounts of what McGahn did with that information. But it was only after Yates' warning became public that Flynn was fired. He has since pleaded guilty to lying to the FBI.

McGahn also beat back an effort by the president to fire special counsel Mueller in June 2017. Trump backed down after McGahn threatened to quit rather than order the Justice Department to dismiss Mueller. The move was first reported by the New York Times.

McGahn's departure had been anticipated since Flood joined the president's legal team. Flood helped represent President Bill Clinton during his impeachment hearings. He also worked in the White House counsel's office during the George W. Bush administration.

McGahn could return to his lucrative career as a partner in the Jones Day law firm, while also doing work for Trump's re-election campaign.

He may also find more time for music. McGahn previously served as lead guitarist and occasional keyboard player in Scott's New Band.