A gunman in India was killed by police Friday morning after allegedly holding more than 20 children hostage during a fake birthday party for his daughter, according to multiple reports.

Earlier, the wife of suspect Subhash Batham was fatally beaten by a mob when she emerged from the house where the children were being held, the reports said.

Batham was reportedly out on bail for murder and wanted to "take revenge" on neighbors he thought were responsible in his arrest, so he arranged a fake birthday party for his 1-year-old daughter and invited other children from his village in the Farrukhabad district of Uttar Pradesh (UP) state to attend Thursday, India Today reported.

All of the children were ultimately rescued safely, UP Additional Secretary Awanish Kumar Awasthi confirmed. They ranged in age from 6 months to 15 years old, the BBC reported.

MAN PICTURED BRANDISHING GUN AT PROTEST AGAINST INDIA'S CITIZENSHIP LAW, INJURES ONE

"There was fear in the neighborhood and nobody slept. Everybody was worried about the safety of children," reporter Deepak Kumar Srivastava told the BBC. "The police tried to convince him to surrender for several hours. They called special forces when their attempt failed."

"There was fear in the neighborhood and nobody slept. Everybody was worried about the safety of children."

— Deepak Kumar Srivastava, local reporter

The children -- as well as Batham's daughter and wife -- were taken captive around 3 p.m., according to India Today. The 10-hour-long standoff lasted much of Thursday into Friday morning. Most of the kids spent nine hours inside the house.

When Batham's wife eventually emerged from the house, a group of villagers beat her, reports said. She was taken to a nearby health center where she died from her injuries, the report said.

A team of National Security Guard commandos was deployed to Farrukhabad via special aircraft, according to India Today. Neighbors reportedly alerted authorities earlier in the day and when police arrived around 5 p.m., Batham started shooting from the home.

VILLAGERS IN INDIA DRESS UP AS BEARS TO SCARE OFF MORE THAN 2,000 MONKEYS

"On learning that he had firing capabilities and after his bomb threats, all senior police officials decided to attack him," UP Director General of Police Om Prakash Singh said.

Police broke through the front door of the home around 1 a.m, firing at the suspect in self-defense, reports say. Batham was pronounced dead at 1:30 a.m, according to police.

Two police officers and one bystander were also injured during the incident.

"He believed that locals were responsible for his arrest in the murder case and he wanted to take revenge," Srivastava added, according to the BBC.

CLICK HERE TO GET THE FOX NEWS APP

Batham had also sent a letter to the local district magistrate earlier, complaining about the lack of toilets in his house because he had a sick mother who had to use the bathroom in the open, according to India Today.