KABUL, Afghanistan — Facing Afghanistan’s first significant outbreak of violence over an anti-Islam film that has inflamed mobs elsewhere, the police moved swiftly on Monday to contain rampaging groups of young men who were burning tires and throwing stones along a thoroughfare leading east out of Kabul, keeping the protesters from advancing toward the city and dispersing them within hours.

A large American base along the route taken by the protesters remained untouched throughout Monday morning’s unrest, and there were no reports of deaths or serious injuries among the police or protesters.

The work by the police earned the praise of Gen. John R. Allen, the commander of the American-led military forces in Afghanistan, and capped nearly a week in which the Afghan government has quietly worked behind the scenes to keep anger over the American-made film, which mocks the Prophet Muhammad, from turning violent. As news of the protests spread around the world last week, Afghan officials across the country gathered elders and religious leaders and told them that it was fine to speak out against the film, “The Innocence of Muslims,” but that they should urge people to stay calm and avoid violence.

Those efforts have continued — many sermons delivered during last week’s Friday Prayer, for instance, were vehemently anti-American and sharply critical of the movie yet concluded with urgings to keep the peace.