Two FBI officials who would later be assigned to the special counsel’s investigation into Donald Trump’s presidential campaign described him as an “idiot” and “loathsome human” in a series of text messages last year, according to copies released on Tuesday.

One said in an election night text that the prospect of a Trump victory was “terrifying”.

Peter Strzok, an FBI counterintelligence agent, was removed from special counsel Robert Mueller’s team earlier this year following the discovery of text messages exchanged with Lisa Page, an FBI lawyer.

Q&A Who is running the Trump-Russia investigations? Show The investigation has two spearheads: special counsel Robert Mueller, operating under the aegis of the justice department (executive branch); and congressional committees (legislative branch). By far the greatest amount of pressure on the White House so far is coming from the special counsel, Robert Mueller, whose team of 17 prosecutors was authorized in May to investigate "any links and/or coordination between the Russian government and individuals associated with the campaign of President Donald Trump" and related matters. This investigation has no set end date, but Mueller appears to be moving quickly, and many observers expect him to issue a report of some kind in 2018, although any talk of a timeline is speculative. Meanwhile three congressional committees are conducting parallel, if less focused, investigations of the Trump presidential campaign, Russian hacking, the firing of FBI director James Comey and related issues. The committees (House intelligence plus Senate intelligence and judiciary) may issue reports at the end of their investigations. They can also call high-profile witnesses for questioning, schedule public hearings and release testimony or other information. At some stage, Mueller is likely to submit his report to Congress. If the report provides evidence of criminal activity by top Trump campaign staff or potentially by the president himself – who has denied all wrongdoing – Congress could come under intense pressure to mount a prosecution. Mueller also has the power to prosecute federal crimes.

Hundreds of the messages, which surfaced in a justice department investigation of the FBI’s inquiry into Hillary Clinton’s use of a private email server, were provided to congressional committees.

The existence of the text messages, disclosed in news reports earlier this month, provided a line of attack for Trump, who used the revelation to disparage FBI leadership as politically tainted. Republicans have also seized on the exchange to suggest the Mueller team is biased against Trump.

The issue is likely to be a focus of a congressional hearing on Wednesday involving deputy attorney general Rod Rosenstein, who appointed Mueller as special counsel in May and oversees his team’s work.

A spokesman for Mueller said Strzok was removed from the team as soon as the allegations were brought to the office’s attention, and that Page had already concluded her work by that time and returned to the FBI. Strzok has been reassigned within the FBI.

The texts seen by the AP began mid-2015, soon after the FBI launched its email server investigation, and continued over the next year and a half as the presidential race was in full swing.

The messages – 375 were released on Tuesday evening – cover a broad range of political topics. There are some derogatory comments about Democratic officials, including presidential candidate Bernie Sanders and former attorney general Eric Holder, but some of the harshest comments are reserved for Trump.

In a 4 March 2016 back-and-forth, Page referred to Trump as a “loathsome human” and Strzok responded: “Yet he may win.” After Strzok asked whether she thought Trump would be a worse president than fellow Republican Ted Cruz, Page said: “Yes, I think so.”

In another exchange, on 18 October 2016, Strzok wrote to Page: “I am riled up. Trump is a fucking idiot, is unable to provide a coherent answer. I can’t pull away. What the fuck happened to our country??!?!”

Weeks later, on election day, as it seemed that Trump could defeat Clinton, he said: “OMG this is fucking terrifying: A victory by Mr Trump remains possible.”

Page replied: “Yeah, that’s not good.”

In August 2016, Strzok responded to a New York Times story that carried the headline Donald Trump is Making America Meaner by saying: “I am worried about what Trump is encouraging in our behavior.”

But he also added: “I’m worried about what happens if HRC is elected”, using the initials for Hillary Rodham Clinton.