CHARDON, Ohio — Wearing a T-shirt with ‘‘killer’’ scrawled across it, a teenager cursed and gestured obscenely as he was given three life sentences Tuesday for shooting to death three students in an Ohio high school cafeteria.

T.J. Lane, 18, had pleaded guilty last month to shooting at students in February 2012 at Chardon High School, east of Cleveland. Investigators have said he admitted to the shooting but said he did not know why he did it.

Before the case went to adult court last year, a juvenile court judge ruled that Lane was mentally competent to stand trial despite evidence he suffers from hallucinations, psychosis, and fantasies.

Lane was defiant during the sentencing, smiling and smirking throughout, including while four relatives of victims spoke.

After he came in, he calmly unbuttoned his blue dress shirt to reveal the T-shirt reading ‘‘killer,’’ which the prosecutor noted was similar to one he wore during the shooting.

A statement released later to local media by the court on the judge’s behalf said that he was not aware of the shirt and that if he had noticed it he would have halted the proceedings and ordered Lane to wear proper attire.

Dina Parmertor, mother of victim Daniel, called Lane ‘‘a pathetic excuse for a human being’’ and wished upon him ‘‘an extremely, slow torturous death.’’ She said she has nightmares and her family has been physically sick over the crimes.

‘‘From now on, he will only be a killer,’’ she said, as Lane’s smile widened. ‘‘I want him to feel my anger toward him.’’

Prosecutors say Lane took a .22-caliber pistol and a knife to the school and fired 10 shots at a group of students in the cafeteria. Daniel Parmertor and Demetrius Hewlin, both 16, and Russell King Jr., 17, were killed.