Image copyright Getty Images Image caption The two officials shared their fears about a Donald Trump win by text message

Republicans have said text messages sent between two FBI agents who later joined a special counsel team investigating Mr Trump's campaign show that investigation is biased.

During Mr Trump's US presidential campaign, the agents exchanged texts calling him an "idiot" and "awful".

They were working on the inquiry into Hillary Clinton's emails at the time.

But Deputy Attorney General Rod Rosenstein said he was confident the team was being run "appropriately".

The content of the text messages was released to the US Congress on Tuesday, and details have been obtained by US media.

In them Peter Strzok, a senior FBI agent, said Mrs Clinton "just had to win".

Lisa Page, an FBI lawyer, called Mr Trump a "loathsome human".

Republican Bob Goodlatte, who chairs the congressional judiciary committee, said the texts showed "extreme bias" against Mr Trump, made worse by the fact that they went on to work on Robert Mueller's investigation into alleged Russian interference in the 2016 presidential election, and if Trump campaign figures were complicit.

They were "investigating the very person for whom they were showing disdain," Mr Goodlatte said.

Mr Rosenstein responded that the FBI had rules against checking a person's politics during the hiring process.

"We are not going to improperly consider political affiliation with our career employees," he said.

He also said Mr Mueller was "running that office appropriately". When asked did he think there was good cause to fire Mr Mueller, he replied; "No."

The messages came into the public domain because the justice department is investigating the FBI's handling of its inquiry into Mrs Clinton's use of a private email server as secretary of state.

The text messages have been known to exist since it emerged earlier this month that in the summer Mr Strzok had been removed from the special counsel investigation into alleged Russian interference in Mr Trump's 2016 campaign.

Mr Trump has previously tweeted about Mr Strzok, calling him "tainted (no, very dishonest?)".

Mr Strzok now works in human resources at the FBI. Ms Page also spent some time on the special counsel investigation but returned to her normal duties before the existence of the text messages was made public.

In other messages, as reported in the US press:

Mr Strzok wrote that he was "scared for our organisation" - the FBI - if Mr Trump won

Mr Strzok called Mr Trump a "douche"

Ms Page called Mr Trump "awful"

"I cannot believe Donald Trump is likely to be an actual, serious candidate for president," Ms Page wrote

She said she thought he would be a worse president than his Republican primaries opponent, Ted Cruz

Mr Strzok wrote that Mr Trump was an "idiot" and was "unable to provide a coherent answer"

On election day, when Mr Strzok saw that Mr Trump might win, Ms Page wrote: "Yeah that's not good"

Under FBI regulations, agents may express political opinions "as an individual". It is not clear whether these texts were sent from work phones.