Juanly Pena was on a “bad spiral” last winter.
Then 14, Pena had been in trouble in school and with the law, and he claimed gang members had been threatening him at school and in his Mattapan neighborhood. So, he met a friend at a T station to borrow a gun, a Suffolk County prosecutor said.
The next day, Pena used the firearm to shoot his 9-year-old brother as he played a video game in the family’s apartment — a fatal shooting that prosecutors and Pena agree was an accident.
Pena, who is now 15, admitted to sufficient facts in Suffolk County Juvenile Court for manslaughter and a firearms charge in the death of his brother, Janmarcos, on Feb. 7.
“Juanly, this was a tragic and horrific accident which I believe you’ll forever have in your memory,’’ said Judge Terry M. Craven, who sentenced Pena to be held in the custody of the Department of Youth Services until he turns 21. “I have to urge you, Juanly, to use your time in DYS wisely.”
Before the shooting, police had been called to the family’s home several times, usually by Pena’s mother asking for help in controlling him. In the courtroom Wednesday, Pena’s mother, Betty Nunez, cried as a prosecutor detailed the case against her son.
Pena has the support of his mother and sister, who “realize that he’s a 15-year-old young man who made a terrible, terrible mistake,” defense attorney Michael P. Doolin said.
Pena told authorities he had obtained the .380 caliber semi-automatic handgun used in the shooting at a Massachusetts Bay Transportation Authority station on Feb. 6, according to an account of the case given in court by Suffolk County Assistant District Attorney Ian Polumbaum.
Pena met an acquaintance at the station who was with a person Pena did not know. That person loaned Pena the firearm, Polumbaum said.
“Juanly said the gun wasn’t for him. It was for somebody else,” the prosecutor said.
The next day, Pena was home with his older sister, mother, and younger brother, who had begged his mother to let him stay home from school, Polumbaum said. Pena had not attended school for most of the winter.
After Nunez left the house around 11 a.m., Pena walked to the den where Janmarcos was playing a video game and “squeezed the trigger,” Polumbaum said. Pena had removed the magazine from the gun, but there was still a live round in the chamber.
The bullet entered Janmarcos’ upper chest, went through his torso, and exited his lower back, striking part of the chair he was sitting in, Polumbaum said.
Powder burns on the boy’s body suggested the gun was fired from two to three feet away, he said. He was pronounced dead at a hospital.
After the shooting, Pena started to call 911 but then handed the phone to his sister, Polumbaum said.
He punched a hole in the wall of the apartment and fled to Walk Hill Street, where officers found him with the gun.
In addition to his confinement, Pena was sentenced to probation on the firearms charge, which will last until he turns 24. If Pena gets into trouble while on probation, he faces a prison term of three years and a day.
Polumbaum had asked Craven to order Pena to be held in “secure confinement” for three years and three months of his total sentence, but Craven ruled that DYS will decide where to place him.
Doolin said he believes the teen will be confined in a secure facility for one to two years of his sentence and have access to educational and counseling services.
“He’s very remorseful for what happened. He feels terrible about this. He looks forward to trying to lead a better life when he’s released,” Doolin said.
A DYS spokesman declined to say where Pena will be held, citing privacy laws.
Pena wrote a letter to Craven, in which he said his brother was his “best friend” and said “he’ll forever miss him,” the judge said.
“You also said that you have aspirations to go to college, sir, and that you wish to change your life entirely,” Craven said. The letter was not made public.
Janmarcos’s killing galvanized police and city officials, who revived a gun buyback program and vowed to stem the flow of illegal firearms. The buyback program continues to operate, officials said.John R. Ellement and Maria Cramer of the Globe staff contributed to this report. Laura Crimaldi can be reached at firstname.lastname@example.org.