HOUSTON -

A student who shot himself in the back of a patrol car was not fully patted-down before he was detained, investigators said Thursday.

Galena Park Independent School District officials said the incident happened at North Shore Senior High School, 353 Castlegory, on Wednesday.

School district officials said a deputy constable on campus got a report that a student at the school planned to hurt himself.

Officials said the student was found in a restroom and he appeared to be mentally unstable. It took two deputy constables to get the student out of the restroom and he was then taken into custody for his safety. An ambulance was called out to the school.

A Harris County Precinct 3 deputy constable briefly searched, handcuffed and placed the student in the back of a patrol car, officials said. He was being detained, not arrested, officials said.

The student was wearing loose clothing and had a concealed gun that was not found during the search, officials said. While being driven to the ambulance, the student, who was face-down in the car, retrieved that gun and shot himself in the back of the head, investigators said.

"When dealing with searches, what you're looking for most often are weapons. You have big weapons and small weapons. Bigger weapons are easier to find," said Thomas Nixon, an attorney and former police officer. "What an officer is going to do, he's going to go outside the pocket and he's going to grab the outside of the pocket and he might even ask, 'What's that in your pocket?' If you have shirt pockets, the officer might glide over that and kind of glide over the waist band," said Nixon.

The student was rushed to Ben Taub Hospital in critical condition. School district officials said the student had surgery and was treated in the intensive care unit.

KPRC Local 2 has learned the identity of the student but has chosen not to identify him because he is a minor.

Officials said the student had been depressed since he broke up with his girlfriend in September. Investigators said there were signs on the student's Twitter feed that something was going to happen.

"Today is the day," he wrote. "Bye guys."

The deputy constable who initially searched the student has remained on duty, officials said.