A Trenton man charged with gun possession after a shootout that left one person dead and 22 injured at an all-night arts festival in June will be held without bail, a judge in Mercer County ordered Friday afternoon.

Amir Armstrong, 23, was charged with illegal possession of a Silver Taurus revolver that police said he was carrying when he was shot in the head during the early morning shooting on June 17 at the Arts All Night event. He was hospitalized for several weeks.

Judge Ronald Susswein ordered Armstrong to be detained in the Mercer County Jail pending trial at a detention hearing.

Authorities say Armstrong is one of three men involved in the shooting, which left people scrambling for cover when bullets began to fly shortly before 3 a.m. inside the Roebling Wire Works warehouse. Several police officers fired their weapons during the encounter with the suspects, authorities said.

In an affidavit of probable cause in the charges against Armstrong, Officer Olix Heredia and Detective Samuel Gonzalez said they heard multiple shots fired inside the building and about 200 to 300 people began "running, falling and screaming, 'Someone's shooting, someone's shooting.'"

Gonzalez said he alerted an operator and requested that more units dispatched to the scene. The officers entered the building with their weapons drawn and began ordering attendees to get down on the ground for safety, he said.

Inside, they located the first victim, a man who had been shot in his legs. Nearby was Armstrong, who had been shot in the head. Armstrong was conscious and told police he was unsure if he had sustained any other gunshots, Gonzalez said. The police began cutting off his clothing to check for other wounds and discovered a silver revolver tucked in his waistband, he said.

A second suspect, Davonte White, 26, also of Trenton, remains hospitalized with gunshot wounds. He also faces weapons charges.

The third gunman, Tahaij Wells, 32, was fatally shot by police during an exchange of gunfire. All three men were gang members, authorities have said, though it's unclear whether they are affiliated with the same gang or how they knew each other.

About 1,000 people were at the show when the gunfire began, sending festival-goers into a panic as they fled in fear. When the shooting stopped, authorities say, 17 people had been wounded, and at least five were injured in the rush to get away from the melee.

Police instructed organizers to shut down the festival after physical altercations broke out before the shooting.

Four Trenton officers were involved in the shooting: Detectives Matthew Bledsoe, Michael Cipriano, and Eliezer Ramos, and Officer Robert Furman. All are on paid administrative leave pending an investigation by the Prosecutor's Office. The investigation will review whether the use of deadly force was justified.

Authorities have not said whether police officers shot some of those who were injured. The prosecutor has declined to reveal how many rounds were fired, or how many times the suspected gunmen were struck. Authorities said they were awaiting ballistic reports from the state police laboratory that may help determine which bullets struck the bystanders.

Investigators believe the shooting stemmed from tension between neighborhood gangs. Wells was released from prison in February after serving time in connection with a fatal shooting committed when he was 17. Behind bars, he remained involved with the Bloods and helped run the gang from prison, authorities said.

The violence marred the annual event, in its 12th year. The festival aimed to attract 30,000 visitors to experience visual artists, short films, and live music groups in a 24-hour marathon.

Staff writer Avalon Zoppo contributed to this article.