Brendan Nicholls, 23, could be heard screaming from the cells at Dandenong Magistrates Court on Monday after being charged with criminal damage and assault.
It's alleged Nicholls and a 22-year-old Cranbourne East man racially abused Imam Ismet Purdic and his wife in Melbourne's southeast on Saturday.
Police say the couple were travelling along the South Gippsland Highway in Dandenong South about 7.40pm when the occupants of a small black hatchback allegedly targeted them.
The couple's vehicle was boxed in and the accused allegedly hurled objects at their car, drove dangerously to intimidate them and got out of their car to assault Imam Purdic and threaten his wife.
The imam is recovering after being punched in the face during the incident, according to the Australian National Imams Council.
Bystanders intervened before the accused allegedly returned to their vehicle and fled.
Nicholls and his co-accused were arrested in Dandenong South on Sunday and charged with criminal damage and common assault.
The 22-year-old man was bailed to appear at court in May, while Nicholls was remanded to face Dandenong Magistrates Court on Monday afternoon.
His lawyer told the court her client was at risk of self-harm and withdrawing from drugs so he could not be brought up from the cells.
She confirmed to the magistrate it was Nicholls whose screams could be heard in the courtroom.
Nicholls was remanded in custody to return to court on Tuesday where he may apply for bail.
An 18-year-old Dandenong South woman who was also allegedly in the car was released pending summons.
The Bosnia Herzegovina Islamic Society in Noble Park condemned the alleged attack against their imam in a social media post.
"The Imam has expressed gratitude that his children were not present, noting the profound trauma the incident has caused," the Facebook post read.
"Imam Purdic has served the community for more than 12 years as a religious leader, educator and interfaith advocate through the Interfaith Network Dandenong, promoting peace, coexistence and mutual respect.
"He has called on all Australians to work together to prevent such hatred and violence."
The Australian National Imams Council described the alleged attack as "cowardly".
"No family in Australia should fear being attacked simply for their faith, appearance, or identity," the statement read.
Victoria Police said there was no place for prejudice-motivated, religious based or hate-based behaviour in society.
"Such activity will not be tolerated," the statement read.
Lifeline 13 11 14
beyondblue 1300 22 4636