National guard troops patrolled northeastern Brazil on Thursday after three nights of rioting allegedly ordered by imprisoned gang members left windows smashed, buses ablaze and at least three people dead.

Most of the violence was in Rio Grande do Norte state where a couple dozen cities have seen gun attacks on public buildings and arson attacks on buses and gas stations since Monday night.

The owner of a supermarket was among those killed in the violence. Also, a rioter in Rio Grande do Norte and another one in neighboring Paraiba state were killed in shootouts with police, authorities said.

Schools in both states canceled school classes Thursday for fear that school buses might be targeted, and some regular bus services were suspended.

BRAZIL REINTRODUCES VISA REQUIREMENTS FOR TOURISTS FROM US, AUSTRALIA, CANADA, JAPAN BEGINNING ON OCT. 1

Fox News South America graphic

Riots blamed on gangs in Brazil's northeast leave three people dead.

CLICK HERE TO GET THE FOX NEWS APP

Rio Grande do Norte’s public security secretary, Francisco Araújo, said Wednesday that the attacks were being ordered from within the state’s biggest prison, after wardens declined to grant prisoners’ demands for televisions, conjugal visits and electricity.

Several Brazilian media outlets also pointed to dire conditions within the prisons, citing a report last year by the Ministry of Human Rights and Citizenship indicating that detainees were subjected to torture, rotten food and unsanitary conditions.

The violence continued despite the deployment this week of over 220 national guard troops to the region.

Brazil’s Justice Minister Flávio Dino on Wednesday also ordered a new task force to boost security within the prison system to try to stamp out any orchestration of violence from within the prison grounds.