A judge has denied bail for the man accused of ploughing his car into a crowd of counterprotesters at a white supremacist rally in the US city of Charlottesville.

Judge Robert Downer said during a bail hearing on Monday that he would appoint a lawyer for James Alex Fields Jr. In the meantime, he has been ordered to stay in jail.

Hours later, US President Donald Trump said those who commit violence "in the name of bigotry" would be held accountable.

"Racism is evil and those who cause violence in its name are criminals and thugs, including the KKK, neo-Nazis, white supremacists and other hate groups that are repugnant to everything we hold dear as Americans," Trump said from the White House.

Fields, who appeared in court through a closed-circuit television, is charged with second-degree murder and other counts after authorities said he drove into the crowd, killing a woman and injuring 19 others.

The judge said the public defenders' office informed him it could not represent Fields because a relative of someone in the office was injured in Saturday's protest.

Downer said a local attorney will be appointed to represent the 20-year-old suspect.

READ MORE: Witnessing the 'monstrous' attack in Charlottesville

The next scheduled court hearing is on August 25, though Fields' attorney could request a bond hearing before then.

Al Jazeera's Heidi Zhou-Castro, reporting from Charlottesville, said security concerns prevented the suspect from appearing in person before the court.

Wearing a black and white striped uniform, Fields answered questions from the judge with simple responses of "Yes, sir" when asked if he understood the judge.

He told the judge, "No, sir" when asked if he had ties to the community of Charlottesville.

Fields allegedly slammed his car at the crowd of people protesting against the white nationalist rally on Saturday, killing 32-year old Heather Heyer, 32, a resident of Charlottesville.

Fields was arrested shortly after and has been in custody ever since.

Before the attack, Fields had been photographed carrying the emblem of Vanguard America, one of the hate groups that organised the "Take America back" campaign in protest at the removal of a statue of a general who supported slavery in the US.

The group on Sunday denied any association with the suspect, even as a separate hate group that organised Saturday's rally pledged on social media to organise future events that would be "bigger than Charlottesville".

Fields was fascinated with Nazism, idolised Adolf Hitler, and had been singled out by school officials in the 9th grade for his "deeply held, radical" convictions on race, a former high school teacher said on Sunday.

He also confided that he had been diagnosed with schizophrenia when he was younger and had been prescribed an anti-psychotic medication, Derek Weimer, the teacher, said in an interview with AP news agency.

In high school, Fields was an "average" student, but with a keen interest in military history, Hitler, and Nazi Germany, said Weimer, who said he was Fields' social studies teacher in his junior and senior years at Randall K Cooper high school in the US state of Kentucky.

"Once you talked to James for a while, you would start to see that sympathy towards Nazism, that idolisation of Hitler, that belief in white supremacy," Weimer said. "It would start to creep out."

The mayor of Charlottesville, political leaders of all political stripes, and activists and community organisers around the country planned rallies, vigils and education campaigns to combat the hate groups.

They also urged President Trump to forcefully denounce the organisations, some of which specifically cited Trump's election after a campaign of racially charged rhetoric as validation of their beliefs.