Police were called to North Shore High School around 10:30 a.m. Wednesday after a concerned student reported that the teenager may try to hurt himself, The Houston Chronicle reported.
Earlier that morning, the teen, whose name was not reported, posted a series of messages on his Twitter account, such as "You say you can't live like this ill [sic] make it easy for you after today!", "Bye guys" and "Ima [sic] make it easier after this period."
The teen was found in the west side of the building and would not cooperate with officers, said police Capt. Jon Moore.
Police searched the teen, handcuffed him, and put him in the back of a police car to transport him to a safe location.
While in the back of the police car, the teen retrieved a "hidden gun" from under his shirt and shot himself, school and police officials said.
He was rushed to a nearby hospital where he is listed in critical condition, officials said.
Moore said it was unclear whether the teen intentionally shot himself or if it was an accident.
Officials with the police department are investigating the incident to determine whether a "proper search" of the teen was conducted, Moore said.