Robert Mueller removed an FBI agent from his investigation into alleged Russian election meddling, people briefed on the matter told US media. The move came after the Justice Department began probing whether the agent had sent anti-Trump text messages.

Mueller, the special counsel examining alleged Russian interference in the 2016 presidential election, removed FBI agent Peter Strzok from the investigation over the summer, according to The New York Times. He was reportedly reassigned from the investigation to the FBI’s human resources department, a move which is largely seen within the bureau as a demotion.

Three sources told the Times that the catalyst was the discovery of text messages in which Strzok reacted to news events – including presidential debates – in ways that could be deemed critical of Donald Trump. The text message exchange was between Strzok and FBI lawyer Lisa Page, another member of Mueller’s team, according to The Washington Post. Strzok and Page, who were engaged in an extramarital affair at the time, reportedly wrote disparaging comments about Trump and appeared to favor Hillary Clinton, according to sources cited by the Post.

“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, as quoted by the Times. Page left Mueller’s team weeks before news of the text messages broke, Carr added.

Meanwhile, the inspector general’s office at the Justice Department said the incident is part of a wider probe into how the FBI has handled investigations relating to the election. It said the office is “reviewing allegations involving communications between certain individuals, and will report its findings regarding those allegations promptly upon completion of the review of them.” A spokeswoman at the Justice Department said “we are aware of the allegation and taking any and all appropriate steps.” The Justice Department inquiry into Strzok is being conducted by inspector general Michael E. Horowitz, who is also leading a broad examination into how the FBI handled the Clinton email probe.

The precise content of Strzok’s text messages is unknown, and it remains unclear whether Horowitz will make them public. However, the FBI does allow its agents to express opinions “as an individual privately and publicly on political subjects and candidates.”

Current and former law enforcement officials who worked with Strzok – who remains assigned to the FBI’s human resources department – told the Times that they are unaware of any incidents in which the agent allowed his political views to influence investigations. They said he was deeply trusted by former FBI director James Comey, and he would have likely become one of the FBI’s top officials if issues had not been raised surrounding the text messages. Although Strzok’s departure from the investigation was reported by ABC News in August, the reason behind the move was unclear until now.

Meanwhile, Mueller continues to lead the investigation into alleged Russian meddling in the 2016 presidential election, despite a complete lack of evidence that Russia interfered in the process in any way. Trump has called the probe a “witch hunt,” while Russian President Vladimir Putin has said the accusation is the result of Clinton’s supporters not wanting to admit the Democratic candidate has only herself to blame for losing the election.

“They are absolutely reluctant to admit this, and prefer to delude themselves and others into thinking it was not their fault, that their policy was correct, they did all the right things, but someone from the outside thwarted them. But it was not so. They just lost and they have to admit it,” Putin told French newspaper Le Figaro in May.