NEW ORLEANS — The man who shot and killed two people during a Mardi Gras parade in New Orleans has pleaded guilty and was sentenced to 45 years in prison.

John Hicks, 20, avoided a life sentence by pleading guilty Monday to two counts of manslaughter, instead of the murder charges he was facing, according to media reports. He also pleaded guilty to one count of obstruction of justice and one count of carrying a firearm on a parade route.

Hicks shot and killed 21-year-old Peter Dabney and 22-year-old Ivan Williams during the St. Charles Avenue Mardi Gras Parade on Feb. 12, 2015. Police said in an arrest warrant that Hicks confessed to the shooting and that he had been in a “verbal altercation that turned physical.”

A police officer at the parade heard the shooting and saw Hicks throw a gun into the bushes, according to the warrant. The officer arrested Hicks.

On Monday, Hicks apologized to the families of the victims.

“I’m sorry for the pain and strain that I put on you,” he said.

Pro Tem Judge Graham Bosworth said in court that Hicks has a chance of one day leaving prison. He urged Hicks to participate in programs while in prison so that he can re-enter society as a productive citizen.

After the hearing, Peter Dabney’s mother Sarah Dabney said she was unsatisfied with Hicks’s sentence.

“I don’t think it’s fair,” she said. “At least he still has a life. My baby, all he has is a gravesite.”