A man who arranged a fake birthday party for his one-year-old daughter, then held more than 20 children hostage, has been shot dead by police.
Local media identified the man as Subhash Batham – saying he was accused of murder but out on bail.
His stand-off with police lasted 10 hours, during which officers tried to negotiate with him.
When police entered the building by force, the man was killed in a shootout.
All of the children, aged between six months and 15 year,s were brought to safety.
Local reporter Deepak Kumar Srivastava told the BBC that residents spent the night in terror.
“There was fear in the neighbourhood and nobody slept. Everybody was worried about the safety of children.
“The police tried to convince him to surrender for several hours. They called special forces when their attempt failed,” he said.
Batham invited children from his village in Uttar Pradesh’s Farrukhabad district to a birthday party for his daughter.
He then held everybody – including his wife and daughter – hostage in the building.
“He believed that locals were responsible for his arrest in the murder case and he wanted to take revenge,” Mr Srivastava added.
Only one six-month old girl was allowed out, when Batham handed her to a neighbour from a balcony, seven hours into the hostage-taking.
Police surrounded the house for several hours
When neighbours alerted authorities and police arrived at the scene, he began shooting from the house.
“On learning that he had firing capabilities and after his bomb-threats, all senior police officials decided to attack him,” said Uttar Pradesh Director General of Police Om Prakash Singh.
“We tried entering the house…Subhash was killed during the encounter.”
During the shootout, his wife, two policemen and one bystander were injured.
According to India Today, Batham had earlier sent a letter to the local district magistrate, complaining about the lack of toilet facilities in his house, and saying he had been denied government housing.
He said he was a labourer and had an ailing mother who had to defecate in the open.
During the drama of the hours-long siege, several television channels appealed to Batham to contact them if he wanted to get his demands to the government or authorities.