SRINAGAR, India — Indian forces who were exchanging fire with insurgents in disputed Kashmir on Saturday fatally shot at least seven civilians when large crowds descended on the site of the gunbattle in support of the militants, police and residents said.

Residents accused troops of directly spraying gunfire into the crowds. Police said in a statement that they regretted the killings but that the protesters had come "dangerously close" to the fighting.

Separatists who challenge India's sovereignty over Kashmir said the killings were part of India's state policy and called for three days of mourning and a general shutdown in Kashmir. Mirwaiz Umar Farooq, a separatist leader, said in a tweet that India's government should "stop this inhumanity as it will not achieve anything except further rebellion and hatred."

The violence started as troops surrounded a village in the southern Pulwama area on a tip that militants were hiding there. Gunmen jumped out of a civilian home and took positions in an apple orchard while firing at soldiers and counterinsurgency police, said Muneer Ahmed Khan, a top police officer.

Three rebels and a soldier were killed and another soldier wounded in the exchange of gunfire, he said.

At the same time, hundreds of people chanting pro-militant slogans and calling for an end to Indian rule over the Himalayan region began throwing stones at troops to help the militants escape. Government forces fired bullets, shotgun pellets and tear gas to stop them, killing seven and injuring at least 40 others, nine of them critically, police said.

Khan said large crowds came from multiple directions while attacking security deployments in the area.

Residents said troops fired indiscriminately at the protesters.

"They fired at us as if they were practicing their guns," said Shabir Ahmed, who accompanied some of the injured to a hospital in Srinagar, the region's main city.

Two police officials, speaking on condition of anonymity because they were not authorized to talk to the media, said the civilians died in the anti-India protests. However, residents said at least two civilians, including a teenage boy, were killed away from the gunbattle.

Soldiers in an armored vehicle fired at a small group of civilians away from the battle site, and as the vehicle jammed on a roadside, the troops fatally shot one of them, said Ubaid Ahmed.

Saturday's killings triggered more anti-India protests and clashes at several places in the region, including Srinagar. No one was reported injured in those clashes.

In recent years, mainly young Kashmiris have displayed open solidarity with the rebels and sought to protect them by engaging troops in street clashes during India's counterinsurgency operations despite repeated warnings from the Indian authorities.

India and Pakistan each claim the divided territory of Kashmir in its entirety. Rebels have been fighting Indian control since 1989. Most Kashmiris support the rebel cause that the territory be united either under Pakistani rule or as an independent country.