MEXICO CITY — Gunmen in a car apparently tried to kidnap a high school student, then opened fire on the youth as he fled into the building, wounding five young people, authorities in the northern Mexico border state of Tamaulipas said Wednesday.

State prosecutors said three suspected assailants and two purported accomplices were detained after Tuesday’s shooting in Ciudad Victoria, the state capital.

Three male high school students and two females were wounded. Three were treated and released, while two were hospitalized, one of them in serious condition, authorities said.

The gunmen pulled up to the high school in a vehicle. The school’s director told local media that the attackers apparently tried to kidnap a male student, who ran into the school. One of the attackers fired at the fleeing student, hitting the five others, the director said.

School shootings are rare in Mexico. In 2017, a 15-year-old boy killed a teacher and shot two students in the northern city of Monterrey.