A beef among teenagers Tuesday night in South Philadelphia ended as a double homicide when two 16-year-old boys — one a junior at St. Joseph's Preparatory School and the other a junior at a Mastery charter school — were fatally shot, according to police.

Homicide Capt. John Ryan said Wednesday that investigators were still trying to sort out what happened, but that the shootings resulted from a dispute between two groups of teens who knew one another. Ryan said the situation was tragically similar to an incident two weeks ago in Oxford Circle when another 16-year-old, Messiah Chiverton, was shot dead during an after-school fight.

"Petty disputes among school-age children, and when you introduce guns into the equation, there's tragedy," Ryan said.

He declined to name or describe any suspects, but said investigators believe one person fired three shots from a .45-caliber handgun. Two shots hit Salvatore DiNubile, a St. Joseph's Prep student who lived on the 2300 block of South 12th Street, where the shooting occurred. One shot struck Caleer Miller of the 1100 block of Dorrance Street in Point Breeze, who attended Mastery's Thomas campus in South Philadelphia.

Attempts to reach relatives of both victims were unsuccessful.

A candlelight vigil for DiNubile at 12th and Ritner Streets drew more than 1,000 people Wednesday evening.

"This is a beautiful tribute of how we in South Philadelphia come together in the face of tragedy, in the face of sorrow, in the face of loss," said the Rev. James R. Casey, pastor of Epiphany of Our Lord Church. He thanked those gathered on behalf of DiNubile's parents, Salvatore and Samantha.

"Everybody loved him, as you can see," said Jordan DePiso, 20, a neighborhood friend of DiNubile.

"He was respectful, selfless. He would put everybody before himself," DePiso said.

DiNubile had the nicknames "Tank" and "Tankie."

"Because he was built like a tank," one friend said.

"He was always protecting somebody," said another friend.

"He was 12th Street," said Alexis, 19, another neighborhood friend.

St. Joseph's Prep, located in North Philadelphia, said in a statement that a Mass in DiNubile's memory was offered Wednesday morning at the Church of the Gesú.

Rae Oglesby, Mastery spokeswoman, said the school was offering counseling services for students.

Police said officers responded around 8:25 p.m. Tuesday to a call about gunshots and found both teens shot in the chest. The officers drove them in patrol cars to Thomas Jefferson University Hospital, where each was pronounced dead within an hour.

A former South Jersey volunteer firefighter who moved to the neighborhood three years ago was at home watching television when he heard three gunshots.

He ran outside and found DiNubile lying on the ground next to the steps of the Hot Waves hair salon on the southwest corner of 12th and Ritner. Miller was lying on the ground about 20 yards west of the intersection.

The former firefighter, who asked not to be named, said he asked somebody at the scene to apply pressure to DiNubile's chest until police arrived to take the teen to the hospital.

Ryan said that police still were investigating the origin of the argument, and that it was not yet clear if the shooter was aiming at anyone in particular.

"We don't know if there were intended targets, or if it was something that happened right away," he said.

Including Tuesday's incident, five teenagers have been killed in shootings this month in Philadelphia, and nearly 150 teens have been shot in the city this year, 24 fatally, according to police statistics.

Twenty-seven teens were fatally shot during all of 2016, the statistics show, and 26 the year before.

In Chiverton's killing, which occurred Oct. 11, police said 18-year-old Muhammed Goode fired a gun during a fight among teens. Goode was quickly arrested because a police officer witnessed the altercation. Goode's mother has said he was bullied by Chiverton and his friends.

Overall, the city had recorded 253 homicides through Tuesday — a 10 percent increase over the same point last year and the most through Oct. 24 since 2013.

Five people, including DiNubile and Miller, were killed in just 24 hours between Tuesday and Wednesday, police said.

Oglesby, the Mastery spokesman, said the school community was heartbroken over Tuesday's shooting.

Miller "had only been a student of ours for about a month, but he'd been engaged in his classrooms … and he was quickly making new friends," Oglesby said.

David Giacomin, hockey coach at the Prep, said DiNubile played for the school in his freshman year, and was well-liked by teammates because of his tenacity and dedication to the game.

DiNubile was "kind of like a 'Broad Street bullies' kind of guy," Giacomin said, referencing the famous 1970s Flyers teams. "Just a really good kid who worked extremely hard when he was there playing hockey."

The statement from the school said: "The entire St. Joseph's Prep community is shaken and terribly saddened by Sal's tragic death. He was well-loved by his Prep brothers, his hockey teammates, and all who knew him. Our thoughts and prayers are with Sal's family and friends at this terrible time."

Staff writers Colt Shaw and Joseph A. Gambardello contributed to this article.