File picture: Eduardo Verdugo/AP

Mexico City - An 11-year-old pupil on Friday opened fire at a school in northern Mexico, killing a 50-year-old female teacher and himself, officials and prosecutors said.

Five students and a sports teacher were injured. One of them was reported to be in a serious condition.

The attack occurred at a private school in the city of Torreon after classes started in the morning.

"The boy asked for permission to go out to change his pants. He took a long time. The teacher goes, addresses him and that's when the problem starts," prosecutor Maurilio Ochoa said on television.

The attacker had two guns, including a high caliber one.

The boy's mother had died, according to Coahuila state Governor Miguel Angel Riquelme. Ochoa said he was living with his grandmother.

The boy was a good student and was not known to have suffered from bullying.

Riquelme said he appeared to have been influenced by video games, but some reports said they had not been violent.

The boy changed into clothing similar to that worn by one of the killers in the Columbine school shooting in the United States in 1999, according to daily La Vanguardia.

It was not known how the boy had acquired firearms.

Prosecutor Gerardo Marquez told Milenio Television that the authorities would analyse the boy's iPad, computer and mobile phone.

School shootings are rare in Mexico. In January 2017, a 15-year-old boy opened fire at a school in Monterrey, killing himself and fatally wounding a teacher who died from her injuries.

dpa