A 19-year-old man pleaded guilty Tuesday to gunning down a former high school classmate during a Central City second-line parade in September 2012.

Glenn Metz pleaded guilty to one count of manslaughter and two counts of attempted second-degree murder.

He was sentenced to 40 years in prison by Criminal District Court Judge Camille Buras.

A jury had already been picked to hear the case when prosecutors Brittany Reed and Robert Moore reached a deal with Metz’s defense attorney, Eusi Phillips. Metz was facing a possible life sentence if convicted of second-degree murder, for which he was originally charged.

Dressed in a silver shirt and black slacks, Metz mumbled softly in affirmation to Buras’ inquiries about whether he understood his plea deal.

Prosecutors had sought to prove that Metz was the gunman who unloaded a volley of bullets on a Sunday parade at South Robertson and St. Andrew streets, killing 18-year-old Jamal Christian and injuring two other men.

According to Christopher Bowman, a spokesman for District Attorney Leon Cannizzaro, Metz fired a .380-caliber handgun, striking Christian in the heart and killing him instantly. Christian’s body fell into nearby bushes and wasn’t found for two days.

Bowman said the two teenagers had been classmates at Booker T. Washington High School before Metz dropped out in tenth grade.

Metz had two previous run-ins with the law in the months before he shot Christian.

In July 2012, he was arrested for possession with intent to distribute marijuana and possession with intent to distribute a counterfeit controlled dangerous substance.

According to prosecutors, police had received a call that two individuals were packaging narcotics on a front porch. When they arrived, they found a woman in possession of 15 bags of marijuana. The woman said the marijuana belonged to Metz.

Police then located Metz, who had what prosecutors referred to as “bunk” or fake cocaine in his possession.

Metz also was arrested a month later for alleged illegal carrying of a weapon.

In a prepared statement, Cannizzaro said Metz’s life choices had sent him down the wrong track. “The lack of a high school education and involvement in the narcotics trade make an individual far more likely to be involved in violent criminal activity,” he said.

Christian’s mother, Tyanka Stevens, gave an emotional address to Metz and the court, in which she characterized her son as a churchgoing entrepreneur who stayed away from disputes on the street.

“I just hope you think about this every day of those 40 years,” she said to Metz. “Just know that you took my heart. Just know that you took my firstborn.”

Stevens said she thought Metz shot Christian accidentally while aiming for another group of men with whom he had a beef. She asked him directly whether he and Christian had been friends, but Metz declined to respond.

“I just wanted you to man up, to say, ‘I’m sorry I hurt your child,’ ” she said.

Prosecutors said Metz gave three statements to police during the case. In the first two, he said he was at the second-line but that it was his friend Lashawn Wells who fired into the crowd.

Wells, 17 at the time of the shooting, pleaded guilty to a slew of charges related to the incident earlier this month and received a 30-year prison sentence.

Prosecutors said that in his third and final statement, Metz admitted to firing a handgun into the second-line crowd. Police said its ballistics matched the bullet that killed Christian.