Dispersing violent crowds is typically a task for the police, although widespread rioting may require military support. One reason unstable countries typically have paramilitary forces is because without them, rioting would be a daily occurrence.
To control riots often non-lethal weapons are used, such as water cannons, rubber bullets, flexible baton rounds and riot control agent.
Deadly force is used in some repressive countries to stop riots, particularly if martial law is declared or in a country at war. This is generally permissible under the laws of war so long as nonparticipating civilians are not intended targets. Collateral damage is a usual result.
See also