Police guarding Kingston Mosque during the English Defence League march had only left the place of worship shortly before the attack took place, a court heard.
After the alert was raised they raced back to the mosque and, in communication with town centre CCTV operators, started arresting the men in nearby roads, the jury heard.
The mosque had a small number of people inside, mostly elderly as young members had been told not to come to avoid reacting to provocation, the court was told.
Interviewed by police, some of the accused denied being outside the mosque, before changing their stories to say they were bystanders, it was claimed.
Others admitted they were there out of “intrigue” but denied being involved, the court heard.
Prosecutor Goopal Hooper said: “Nobody who had their eyes open, his ears unaffected could have failed to notice members in their group were armed, could have failed to hear what witnesses say was being shouted.
“Nobody could have gone down that road to the mosque merely to watch.”
Mr Hooper said after the EDL demonstration, the nine men accused of the attack went to the King’s Tun pub and then walked up Richmond Road toward the mosque in a large group of men who were carrying wood, bottles and glasses of beer.
Some shouted “let’s go”, while others lifted hoods and wrapped scarves around their faces before beginning the attack, the jury heard.