A man sprayed a corrosive chemical on Monday afternoon inside a kindergarten in southwest China, injuring 51 students and three teachers, according to the official state news agency.

The attack, which took place in the Yunnan Province city of Kaiyuan, left two people with serious injuries that were not considered life-threatening, according to the Xinhua news service.

An hour after the attack, the police detained a 23-year-old man, whose surname they gave as Kong. The authorities said he sprayed the chemical, called caustic soda, “as a revenge on society,” Xinhua reported.

Caustic soda, also known as sodium hydroxide, can be a colorless to white substance appearing as flakes, beads or a granular form, according to the Centers for Disease Control and Prevention. The substance can cause irritation to the eyes, burns to the skin and a temporary loss of hair.