HONG KONG — The Hong Kong authorities said on Thursday that they had charged two men with rioting over a mob attack on protesters and passers-by in a train station in a satellite town last month. The assault led to widespread criticism of the police for their failure to stop the violence and of prosecutors for the time it took to charge anyone.

Dozens of people were injured — including journalists, protesters, a pro-democracy lawmaker and bystanders — when more than 100 men dressed in white shirts and wielding sticks and metal bars swarmed inside the Yuen Long train station in northwestern Hong Kong on July 21. On Wednesday, thousands gathered in Yuen Long to remember those injured in the attack and to call for swifter prosecution.

No suspects were arrested in the hours after the violence. A police official said that none of the men were seen with weapons, despite photographs and video of officers talking to men in white shirts holding sticks and metal rods.

In the weeks after the attack, the police arrested more than 20 people, including some who had connections with organized crime. On Thursday, Kong Wing-cheung, senior superintendent of the Police Public Relations Branch, sought to justify the apparent delay, saying that the police sometimes do not make immediate arrests when they fear it could escalate volatile situations.