(HOUSTON) -- Police are investigating how officers failed to find a gun after searching and handcuffing an agitated Texas high school senior who shot himself in the head while riding in a police car.
Capt. Jon Moore with the Harris County Precinct 3 constable's office told ABC News that while the deputies did a pat down on the boy, they did not do a complete search.
"The intent was not to arrest. The intent was to get him help," said Moore. "They just missed it, and I wish I could say different."
The 17-year-old student at North Shore Senior High School in Galena, whose name has not been released, is in critical but stable condition at Ben Taub Hospital in Houston, Harris County Sheriff's Office spokeswoman Christina Garza said.
"There have obviously been some questions that need to be asked," said Jonathan Frey, interim director of communications for Galena Park Independent School District. "How did the boy get the gun after the search?"
Frey said the boy had sent messages to a friend indicating that he was going to hurt himself on Wednesday. She reported it to an administrator, who immediately contacted a deputy on campus, he said.
The district has a contract with the Harris County Precinct 3 constable's office to provide security at the school, said Frey.
"[The deputy] went down, found where the boy was, restrained him and took him to the police car," Frey said. "He was handcuffed and put in the back. As they were leaving, somehow, he pulled out a gun and shot himself."
Moore said the deputy found the student in a restroom on campus alone. The deputy who responded could not get the student to comply with verbal commands, and called for assistance, he said.
Moore said deputies handcuffed the student and were able to get him outside the school, into the police car and in the back seat.
The deputy driving the vehicle was taking the boy to an ambulance on school grounds when he heard a pop, said Moore. When the deputy got out of the vehicle to check on the student, he saw that the teenager had shot himself.
"We didn't know what the situation was. The deputy and the school felt it was better to be safe," said Moore of the ambulance's presence. "He was threatening to harm himself, but we didn't know if he took pills."
Now, the Harris County Sheriff's Office is investigating the incident.
"All indications at this time are that he had threatened to hurt himself in the past, based on witness testimony, and friends and family," said Garza. "At this time, [the investigation] points to it was a self-inflicted gunshot wound. "
Copyright 2012 ABC News Radio