A small J.R.O.T.C. gathering turned deadly on Tuesday when a student brandished a handgun that he had brought to a Houston-area high school and pulled the trigger, unintentionally killing an upperclassman who had already enlisted in the Army, the authorities said.

On Wednesday, a Texas prosecutor announced that the 16-year-old suspect and fellow J.R.O.T.C. student at Bellaire High School had been charged with manslaughter. The suspect fled and was captured several hours later, prompting fears of another targeted shooting in a state that has endured a spate of gun violence.

The authorities did not release the suspect’s name because of his age.

The Bellaire Police Department identified the victim on Wednesday evening as Cesar Cortes, 19, whom the high school’s Junior Reserve Officers Training Corps website listed as the Delta Company commander and showed in his dress uniform.

Friends and family members released balloons and held a candlelight vigil on Wednesday for Mr. Cortes, whom they described as a focused young man who was dedicated to a military service career and his physical fitness regimen.