BROWNSVILLE, Texas - Police shot and killed an armed teenage student who "engaged" officers in the main hallway of his school on Wednesday, the Texas school district said.

Brownsville school district officials said administrators immediately called police after the student brandished a weapon about 8 a.m., shortly after classes started at Cummings Middle School. When police arrived, the student "engaged" the officers and was shot, district spokeswoman Drue Brown said in an emailed statement.

Cameron County Justice of the Peace Kip V. Johnson Hodge pronounced the student dead at a hospital and has ordered an autopsy, said court co-ordinator Israel Tapia.

The school, with an enrolment of about 750 students, was placed on lockdown when administrators called police. No one else was injured, Brown said.

One student who said he was two classrooms from where the shooting took place said the school was already on lockdown when he heard three shots. Miguel Grimaldo, 12, said students later followed police out of the building and boarded buses that took them to a neighbouring park.

"For now they're not saying anything, just pick up your kids," said the boy's mother, Maria Grimaldo.

Brownsville police Detective J.J. Trevino said investigators hadn't determined whether the student fired any shots, and he said officers had no information on why the student had the gun on him.

"It's still under investigation, as far as how he came about to bringing the weapon or if he encountered anybody or anything else," Trevino said.