This article was reported by Thomas Fuller, Seth Mydans and Kirk Semple and written by Mr. Fuller.

BANGKOK — A bloody crackdown in Bangkok by the Thai military set off rioting and arson attacks on Wednesday in several places across Thailand, threatening to expand unrest and further aggravate the deep rifts that have hobbled Thai society for the past four years.

Troops and armored military vehicles overcame grenade-wielding militants allied with antigovernment protesters in Bangkok, forcing the movement’s leaders to turn themselves in to the police.

But even as the government declared victory in quashing a debilitating protest that had shut down parts of Bangkok for two months, the rampage across Bangkok and in at least three provinces in the country’s populous northeastern hinterland raised concerns about the conflict’s spreading and the future of the current government.

The government declared a curfew in 24 of the country’s 76 provinces, a radical move underlined by its announcement that looters or arsonists would be shot.