The plan was to scare a car full of people by shooting in the air. Then a teen died.

Danny Alvarez, 17
Danny Alvarez, 17

When 17-year-old Danny Alvarez showed up at the hospital with a gunshot wound, he was dead within the hour.

Nearly two weeks later, Miami police said they found the person who pulled the trigger. Jordan Applewhite, 21, and Harlan Laszlo Rifkind, 19, were arrested and charged with killing the teen, but both men said Alvarez’s death was an accident.

Applewhite and Rifkind told police they drove to the area of Southwest 31st Avenue and Fourth Street around 1 a.m. on Jan. 6 with a plan to shoot Applewhite’s SKS assault rifle in the air near a car full of people to scare them, possibly because of a robbery a few weeks earlier over some marijuana.

But when Applewhite stepped out of the Toyota Prius and fired his gun, police said, he hit Alvarez.

The teen was in the backseat of his friend’s car when the shooting started. One of the people in the car told police Alvarez shouted “I’m hit! I’m hit!” and collapsed. They drove him to Coral Gables Hospital, where he later died.

Over the next two weeks, police interviewed witnesses in Alvarez’s car, who identified Applewhite and Rifkind in photo lineups. On Thursday, police said, Applewhite showed up at the police station to turn himself in.

Applewhite said “he did not know that the victim had been shot and that he did not mean to do it and said that he meant to shoot into the air.”

Applewhite was charged with first-degree murder. Rifkind, who police said drove the car, was charged with accessory after the fact.