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

Special counsel Robert Mueller removed a top FBI agent over the summer helping to investigate Russian interference in the 2016 election, a spokesman for Mueller's office said Saturday. Confirmation of the agent's dismissal from his role on Mueller's team came after two reports surfaced that said the agent may have shared texts that were critical of President Donald Trump.

The agent, Peter Strzok, a counterintelligence veteran, was reassigned when the Justice Department inspector general's office found potentially disparaging texts he sent to a colleague, The Washington Post and The New York Times first reported.

The matter is now an ongoing investigation by the inspector general's office, the FBI said.

Strzok was exchanging the texts with Lisa Page, an FBI lawyer with whom he was having an extramarital affair, The Post reported. Page was also on Mueller's team but left two weeks before the alleged anti-Trump texts were found. NBC News has not confirmed the contents of the messages and other details of Strzok’s removal.

"Immediately upon learning of the allegations, the Special Counsel's Office removed Peter Strzok from the investigation," said Peter Carr, a spokesman for the special counsel's office. "Lisa Page completed her brief detail and had returned to the FBI weeks before our office was aware of the allegations.”

Strzok had also worked on the FBI's inquiry into whether former Secretary of State Hillary Clinton mishandled classified information on a private email server, The Times and The Post reported.

Trump responded to the news in a tweet early Sunday morning.

Report: “ANTI-TRUMP FBI AGENT LED CLINTON EMAIL PROBE” Now it all starts to make sense! — Donald J. Trump (@realDonaldTrump) December 3, 2017

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

Strzok's dismissal from the Russia probe came as the Mueller investigation was gaining momentum. FBI agents searched the residence of Trump's former campaign manager Paul Manafort mere days before Strzok was removed.

Evidence uncovered during that raid was ultimately used to indict Manafort and his longtime business associate Rick Gates on 12 charges, including conspiracy against the United States.

In May, Mueller, who previously ran the FBI for more than a decade, was tasked with heading the investigation into potential collusion between the Trump campaign and Russia. The special counsel's office has not said publicly whether anyone on the campaign conspired with Russia to help Trump win.

Attorney General Jeff Sessions, who has recused himself from matters relating to the Russia investigation, said in a statement that if proven to be true the agent's actions "would raise serious questions of public trust."

"My job is to restore confidence in the Department of Justice in all aspects of our work and I intend to do so," said Sessions, whose recusal following revelations that he had failed to disclose meetings with Russia's ambassador to the U.S effectively paved the way for the appointment of Mueller as special counsel.

"As such, I have directed that the FBI Director review the information available on this and other matters and promptly make any necessary changes to his management and investigative teams consistent with the highest professional standards."

Related: Trump tweet suggests he knew Flynn had lied to FBI at time of firing

Meanwhile, the reasons behind Strzok's dismissal was revealed less than a day after Trump's ex-National Security Adviser Michael Flynn pleaded guilty to giving a false statement to the FBI about his communications with Russia.

Flynn is the first senior White House official to be charged in the special counsel's investigation into Russian meddling in last year's presidential election. The retired Army general and former head of the Defense Intelligence Agency during the Obama administration was among Trump's early and most prominent supporters.

Throughout the campaign, Flynn advised then-candidate Trump on national security issues and was even considered to be a vice presidential candidate.

A source close to the White House told NBC News that the Trump administration was "blindsided" by the news of Flynn's plea Friday.

Related: Michael Flynn pleads guilty to lying to FBI in Mueller probe

And on Saturday, the president made his first public comments about Flynn's plea, in a tweet that appeared to suggest that he knew Flynn had lied to the FBI at the time he was fired.

A two-page charging document filed Thursday lists two false statements Flynn made about his interactions with Russian ambassador Sergey Kislyak in late December 2016.

Flynn had contacted the Russians at the urging of two top transition officials, according to a court document.

Three people familiar with the matter told NBC News that one of the officials referenced in the document is Jared Kushner, Trump's son-in-law and senior adviser. Two people familiar with the matter said the other is K.T. McFarland, who served as a deputy national security adviser from January to May.