Washington (CNN) White House lawyer Ty Cobb is leaving his position, and a lawyer who represented former President Bill Clinton during his impeachment process is joining President Donald Trump's legal team as it adopts a more adversarial posture toward the special counsel's investigation.

Cobb has been discussing his retirement for several weeks and let chief of staff John Kelly know he would be retiring at the end of May, White House press secretary Sarah Sanders said in a statement. She later confirmed reports that Emmet Flood, who represented Clinton in the late 1990s, is joining the White House staff.

"I've done what I came to do in terms of managing the White House response to the special counsel requests," Cobb told CNN. "I'm extremely grateful to the President and Chief Kelly for the opportunity to serve my country."

A source familiar with Cobb's departure said the former federal prosecutor, who joined Trump's legal team in July 2017 , had been clashing with the President in recent weeks over Trump's combative posture with the special counsel's investigation. Trump has intensified his public attacks on Robert Mueller's probe in recent weeks, and on Wednesday, suggested that questions by Mueller's team about whether he obstructed justice amount to a "setup & trap."

Two sources told CNN that Cobb was uncomfortable with Trump's tweets against Mueller, with one source describing a "rancid" atmosphere between Mueller and the White House.

"Ty was uncomfortable with the Mueller tweets," the source said. He was not going to be "part of a mud-slinging campaign," one of the sources added.

Cobb had tried for weeks to counsel the President against threatening the Mueller investigation, the sources said. The lawyer made it clear on multiple occasions with the President and other members of the legal team that he "can't go down that path," one of the sources added.

Flood steps into 'chaotic atmosphere'

A source familiar with the developments told CNN that one reason Flood took the job was because he is likely to replace current White House counsel Donald McGahn in months.

It's not immediately clear what Flood's job will be on the legal team and if he will attend meetings with Mueller.

Another source familiar with the matter told CNN that Flood had been under "serious consideration" for some time, and that a transition period is expected, as Flood leaves his law firm to join the "chaotic atmosphere" of the White House. This source expects Flood will get along well with McGahn and called the new White House lawyer "very smart, battle-tested, high integrity."

McGahn could leave the White House in the coming months, according to sources familiar with the discussions. He has an interest in issues such as the judiciary and deregulation but the schedule is at times grueling and he is one of the President's longest-serving staffers. According to one source, one thing that could keep him in the White House is a Supreme Court retirement -- which would give him the opportunity to help shape the court with another conservative jurist -- but he could also decide to return to electoral politics in the coming months. Another source tells CNN that McGahn is expected to rejoin the campaign when he leaves the White House.

Flood's arrival at the White House gives the President options should McGahn leave. McGahn, says one source, worked hard to get Flood to the White House.

CNN reported in March that Flood was among several high-profile lawyers to have previously turned down invitations to join Trump's legal team. One of the sources told CNN on Wednesday that Flood was not willing to work with Trump's original lawyer, Marc Kasowitz.

Wednesday's developments are the latest of several recent changes in Trump's legal team.

Last month, former New York City Mayor Rudy Giuliani joined Trump's outside legal team and said at the time that he would communicate with Mueller to bring the probe to an end. Sources told CNN last week that Giuliani met with Mueller to discuss a potential presidential interview.

Marc Mukasey, a longtime ally of Giuliani, is in talks to possibly join Trump's legal team , according to sources familiar with the matter.

Adding Mukasey to the President's roster of lawyers outside the White House is under consideration, but sources cautioned that a final decision has not been made. Mukasey declined to comment. Trump attorney Jay Sekulow declined comment as well.

Trump in March announced he had brought on lawyers Joe diGenova and Victoria Toensing, but his lawyer, Jay Sekulow, acknowledged in a statement that conflicts prevented the pair from joining Trump's team.

Toensing said Wednesday the shake-up of Trump's legal team is just due to the investigation changing over time.

"There is a time to sow and a time to harvest. For the first months of this investigation, it was a time to cooperate and turn things over. Everyone knew this day would come when you had to decide whether the President was going to decide to sit down with Mueller or fight a subpoena. This isn't any different, it's just because of the timing," she said on CNN's "Erin Burnett OutFront."

Showdown looms

The shakeup of Trump's legal team comes as his lawyers prepare for a legal showdown with Mueller, sources familiar with their thinking have told CNN

Trump's legal team is bracing for the dramatic possibility that Mueller would subpoena the President, setting up a collision that could force a lengthy court fight and test the legal limits of the President's power all the way up to the Supreme Court.

Mueller has raised the possibility of a presidential subpoena in at least one meeting, according to two sources. But some of the President's legal advisers are gambling that Mueller would not go that far.