Authorities have identified the 32-year-old man shot and killed by police during an outbreak of gunplay in Trenton at the Art All Night festival early Sunday morning.

Tahaij Wells was shot and killed by police after allegedly exchanging fire with at least two other suspects in a burst of violence that injured 22 people, 17 of whom were shot, Mercer County Prosecutor Angelo Onofri said during a press conference Sunday evening.

The shooting appears to be a gang-related dispute, Onofri said.

Wells. (Mercer County Prosecutor's Office)

Prior to the shooting, fights broke out inside and outside Roebling Wire Works, where the annual event was held. Police attempted to disperse the crowd and urged the organizers to shut down the festival, Onofri said.

"Those individuals continued to loiter and additional fights broke out, and then the shooting occurred," Onofri said, noting the suspects first shot at each other before police opened fire.

Authorities said Wells was carrying a handgun with an extended magazine -- a gun that's illegal to possess in New Jersey. It was one of several guns recovered at the scene. Authorities also commented on his violent past.

Wells was sentenced in 2004 to 18 years in state prison after pleading guilty to aggravated manslaughter in the fatal shooting of 22-year-old Robert McNair during a dispute over who should drive a car Wells had driven from a local bar. Wells was 17 at the time of his killing, authorities said.

At the time of the 2002 killing, after Wells had been announced as a suspect, his mother told the Times of Trenton "he (was never involved) in things like this."

The latest on the shooting in Trenton that left one dead and injured 22 at the Art All Night festival early this morning from the Mercer County Prosecutor. Posted by NJ.com on Sunday, June 17, 2018

Records show that in 2010, Wells -- still serving time for the 2002 killing -- was sentenced to six more years after pleading guilty to a second-degree racketeering charge following a prosecution by the state Attorney General's Office.

In that case, state prosecutors said Wells had helped David "Duke" Allen, the imprisoned leader of the Bloods' Nine Trey Gangsters faction, run his gang from behind bars. The Attorney General's Office has described Wells as an alleged Bloods gang member.

He was released from prison in February, records show.

Onofri also said two other suspects, Amir Armstrong and another he did not identify, are in the hospital in critical and stable condition, respectively. He did not detail the charges facing the two.

A search of state court records did not show any prior felony convictions for Armstrong.

The other two injured people who were previously in critical condition Sunday -- including a 13-year-old boy shot in the melee -- have been upgraded to stable condition, Onofri said.

It is possible that some victims were injured by cops' bullets as officers were shooting at the suspects, officials said. How many shots were fired in all is still under investigation, they said.

The fatal eruption of gunfire had a noteworthy impact in a city where gun violence is not uncommon. By Sunday evening, Trenton Public Schools had announced they would adopt beginning Monday a "shelter-in-place" policy, barring access to school buildings by anyone other than students or staff.

The gunfire rang out at around 3 a.m. at the celebrated community event in Trenton, when about 1,000 people were in attendance. Officials said they are still investigating what sparked the fight, but noted that the arts event did not seem to be a target of the violence.

Authorities said Art All Night organizers were in the midst of shutting the event down when the shots rang out.

Organizers could not immediately be reached for comment, but did post a message on the Art All Night Facebook page saying they were "very shocked" and "deeply saddened" by the violence.

Reporter Thomas Moriarty contributed to this post.

This post has been updated to reflect Tahaij Wells' age -- he was 32.

Sophie Nieto-Munoz may be reached at snietomunoz@njadvancemedia.com. Follow her at @snietomunoz.

Paige Gross may be reached at pgross@njadvancemedia.com. Follow her at @By_paigegross Find NJ.com on Facebook.

Have a tip? Tell us. nj.com/tips