Police were searching for the owners of the elephants and trying to establish what caused the violent behavior, rare among tamed elephants. Angry villagers protesting the lack of protection burnt down the local forestry office.
The rampage occurred Wednesday in an area bordering India's Assam and Mizoram states, said Gautam Ganguly, a senior government official in the area.
The two elephants, a male and a female, ran through at least five villages in Assam, trampling anyone who got in their way and knocking down several of the mud-and-thatch houses before crossing into the neighboring state of Mizoram, where police were called in.
"Men of the Mizoram Police finally gunned the elephants down after dusk," Ganguly said.
It was not immediately clear what caused the two elephants, who were used in logging operations, to lose control.
Ganguly said it was possible that the male elephant was in a state called "musth," a little understood period when male elephants often become aggressive.
The Press Trust of India news agency said the incident started when the male was hit on the head by a falling log.
Local government officials said the families of the dead would receive 50,000 rupees (US$1,250; EUR910) in compensation.
The remote region is home to some 5,000 wild Asiatic elephants, and conflicts between the elephants and humans have been on the rise due to constant encroachment on the animals' habitat. However, attacks by domesticated elephants are extremely rare.