DIALGAM, Kashmir — Security forces in the Indian-controlled portion of Kashmir killed two militants on Saturday, including a top commander, in a gun battle that also left two civilians dead.

The fighting erupted in the village of Dialgam, in the southern Kashmir Valley, where the militants had taken shelter in a home.

The security forces were seeking Bashir Ahmad Wani, a commander with the group Lashkar-e-Taiba, who orchestrated an attack that killed six police officers in the area last month, said Shesh Paul Vaid, the region’s police chief. Mr. Wani and another Lashkar-e-Taiba militant were killed in Saturday’s operation, Mr. Vaid said.

Mr. Vaid accused the militants of holding some villagers as “human shields” and said that 17 people trapped when the fighting erupted had been rescued.