Chinese police have released surveillance video of a stabbing spree that left 23 students wounded at an elementary school.

The video made public late Tuesday shows dozens of students running out of a gate in panic after a knife-wielding man stormed in, apparently having slashed at a girl along the way.

The video released by local police to state-run China Central Television offers the first images from Friday's attack in Chenpeng village in central China. Police have arrested a suspect, Min Yongjun, on a charge of jeopardizing public security.

Citing local police, the official Xinhua News Agency said Min, driven by doomsday rumors, wanted to "do things to impress the world of his existence" before his death. Some people believe the Mayan calendar predicts an apocalypse this Friday.

Xinhua said Min, 36, has epilepsy but that police believe the man was capable of self-control at the time of the stabbing spree.

It said Min had beaten his parents and daughters on Thursday night, left home and wandered around for the night before he broke into an elderly woman's house, where he wounded her by stabbing her twice with a kitchen knife.

Min then went to the elementary school around 7 a.m., where some students had arrived early to do cleaning and preparation work, Xinhua said.

In the surveillance video, a man in blue is seen running through an unguarded school gate while chasing after and slashing at a girl, who stumbles but — after the man leaves — stands up, picks up her school bag and walks out of the gate.

Then, dozens of students flee out of the gate before several men armed with brooms walk in. The man in blue later is seen being chased out of the school.

Deputy Principal Li Chuanbao told state-run China News that there were casualties on the stairs because students on higher floors left their classrooms and ran down to check out the stir.

"They didn't know there was a stabber out there," Li said.

Li told China News that the attacker stabbed seven first-graders on the first floor.

Xinhua said eight of the 23 students stabbed have been transferred to a hospital in a neighboring province for surgeries for facial wounds so they can have less noticeable scars.

Classes at the school resumed Monday with empty seats but tighter security, according to state media reports.