A 15-year-old boy accidentally shot himself to death while he and his two close friends played with a handgun inside a Glen Cove home, authorities said Thursday.

The teenager, identified by his family as Derek Cosme of Glen Cove, was in the kitchen of one of the friends’ William Street home at about 8 p.m. Wednesday when he handled the gun and it went off, Glen Cove and Nassau police said.

Cosme’s friends, both 15, ran to the house of a neighbor, who called 911, said Glen Cove Det. Lt. John Nagle, and when officers arrived, the pair was “forthcoming” and led investigators to their friend. Cosme was pronounced dead at the scene.

“Kids got access to a gun, playing games and this is what happened,” Nagle said. “It’s not clear if they were playing any specific game or whether it was horseplay with the gun.”

Stunned and baffled by Cosme’s death, his family said he was loved as the “baby” and the only boy among five children. He was an incoming 11th grader at Glen Cove High School.

Police investigate the scene of a fatal shooting on William Street in Glen Cove on Thursday, Aug. 3, 2017. Photo Credit: Howard Schnapp

“My brother was a good kid,” said sister Shedarra Vasquez of Glen Cove. “Prior to yesterday, he never played with a gun. He never asked my mom for a gun. He didn’t have toy guns when he was growing up. He was more a video gamer.”

advertisement | advertise on newsday

As his family mourned Thursday, Glen Cove and Nassau detectives said many questions surrounding the boy’s death and the circumstances afterward still needed answers.

Investigators want to know how Cosme got access to the handgun and why, as he lay mortally wounded, his best friends ran to a neighbor instead of calling 911. Also unanswered, Nagle said: questions over how much time passed between the shooting and the 911 call as well as if the best friends sent text messages to their friends just after the shooting.

“It appears that this was an accidental shooting and that three juveniles had access to a licensed pistol holder’s weapon,” said Det. Lt. Stephen Fitzpatrick of the Nassau police homicide squad.

The gun was a revolver licensed to a retired Nassau County corrections officer living at the home, the grandmother of one of Cosme’s best friends, Nagle said.

“It should have been secured. It should’ve been locked away,” said Tahessha Vasquez, 31, another sister of Cosme.

Police declined to release other details of the investigation.

“We haven’t interviewed everyone yet,” Nagle said. “There’s a lot of minutiae detail we have to draw out to make sure things happened the way we think they happened.”

Word had spread in the community of the shooting shortly after it happened, and Cosme’s family, relatives and friends flocked to the scene, upset at the lack of information.

At one point, officers at the scene called for help to control the crowd, Glen Cove police said.

“It got pretty dicey there for a while,” Nagle said, “because the family members wanted nothing more than to enter the house and do their own investigation.”

advertisement | advertise on newsday

Shedarra Vasquez said her brother hoped to be a music producer, and was planning to take classes at BOCES.

She said the three boys at the house where the shooting took place had been friends since kindergarten.

At Glen Cove High School on Thursday, school district officials were making counselors available for anyone emotionally affected by the shooting.

“After any tragedy, it is a somber atmosphere,” said Maria L. Rianna, Glen Cove’s superintendent of schools. “It’s the loss of a loved one.”

Cosme’s aunt, Geraldine Cosme, 47, of Glen Cove, said the family was told the bullet that killed him entered one side of the temple and exited on the other side.

advertisement | advertise on newsday

She said she went to the morgue Thursday to identify her nephew’s body.

“It breaks my heart. He was only 15 — so young,” she said in an interview outside of the boy’s home.

A text chat provided by one of Cosme’s aunts, Maria Vasquez, traced some of his final moments. At 6:16 p.m. he wrote, “Do you think you can pick me up at 8.”

At 6:40 p.m. Vasquez responded, “Where you at.” At 8:07 p.m.: “Coming now.” 8:09 p.m.: “You not answering you walking.”