HONG KONG — The police in Shanghai say a man armed with a kitchen knife killed two boys in an attack outside an elementary school on Thursday morning.

Another boy and a woman were also stabbed, but their injuries were not life-threatening, according to a statement from the police in the Xuhui district of Shanghai.

The attack occurred outside the Shanghai World Foreign Language Primary School at about 11:30 a.m. Bystanders helped grab the suspected assailant, whom the police described as a 29-year-old unemployed man who had moved to Shanghai this month.

Photos on Chinese social media showed a man tied up with a length of webbing and lying face down on the sidewalk as uniformed officers watched over him.