NEW DELHI — Twelve people have been arrested in southern India for not standing while the national anthem was being played at an international film festival, police said Tuesday.

The arrests Monday follow a ruling by India’s Supreme Court last month that said the anthem must be played before every film screening in the country, accompanied by an image of the national flag, and that audiences must stand. The court said the rule was aimed at instilling a sense of patriotism.

The 12 people, all Indian citizens, were arrested in two separate incidents at the film festival, said Anil Kumar, inspector of police in Thiruvananthapuram, the capital of Kerala state. They were released on bail.

Volunteers at the International Film Festival of Kerala, being held in Thiruvananthapuram, complained to police that the 12 refused to stand despite repeated requests, Kumar said.

Vineesh Kumar, one of the 12, told the Indian Express newspaper that there was a scramble for seats at the open air theater where the movie was being shown.

“If we did not sit on the chairs, I thought we would lose the seats,” he said. Kumar said he had stood during the anthem before movies shown earlier in the day.

On Sunday, eight people were beaten by right-wing activists for not standing while the national anthem was being played at a cinema in the southern city of Chennai, according to police.

Police later registered cases against the eight for allegedly showing disrespect to the national anthem.

The top court’s ruling comes amid an increase in nationalistic attacks since the rightwing Hindu nationalist Bharatiya Janata Party came to power in mid-2014.

In October, Salil Chaturvedi, who uses a wheelchair, was hit on the head by people standing behind him when he remained seated during the national anthem at a cinema in Panjim in the southern state of Goa.