But among that joyous crowd, authorities say, was an 18-year-old man who was engaged in a gang-related feud and armed with a Taurus .357 revolver.

Prosecutors allege that despite the presence of partygoers and police officers, Keith Williams of Dorchester opened fire on a rival group, striking 26-year-old Dawnn Jaffier in the head and grazing the leg of another woman.

Get Fast Forward in your inbox:

Forget yesterday's news. Get what you need today in this early-morning email.

“Right now, we are looking at a gang connection as a possible motive,’’ Boston Police Commissioner William B. Evans said Monday at a news conference. More arrests are possible, officials said.

Evans spoke after Williams was arraigned in Dorchester District Court, where not guilty pleas were entered on his behalf to charges of murder, assault and battery with a dangerous weapon, and firearms offenses.

Williams stood out of view of courtroom spectators at the request of his lawyer, who said witness identification of the gunman is an important issue in the case.

Among those in the audience was Jaffier’s father, Ian, who sat in the front row of a packed courtroom gallery guarded by a heavy police presence.

Suffolk Assistant District Attorney Mark Lee told Judge James Coffey that Williams was standing on Blue Hill Avenue when he fired a revolver in the direction of Charlotte Street.

Jaffier was standing there with friends, Lee said. She was there to take part in the J’ouvert celebration, which is part of the annual Caribbean festival, two friends said. Officials say she was an innocent victim.

“One of those gunshots struck Miss Jaffier in the head and subsequently killed her,” Lee said.

A second bullet traveled to the intersection of Blue Hill Avenue and American Legion Highway, where it grazed the leg of Lealah Fulton, who also was with friends, Lee said.

“That bullet struck her in the leg and actually did not penetrate her skin but dropped down exactly where she was hit,” Lee said.

Evans said investigators are examining whether Jaffier and Fulton were caught in cross-fire.

Suffolk District Attorney Daniel F. Conley made a direct appeal to witnesses.

“We can’t afford for potential witnesses to become complacent now that a suspect has been identified,” he said. “If you have specific information about this homicide, or even more general observations about individuals in the area at the time it occurred, please come forward.”

After the shooting, Williams and two companions fled to nearby Drummond Street, Lee said. There, Williams was seen stashing a revolver in the yard at 11 Drummond St., he said.

The weapon was found covered in leaves and a cobblestone in front of the house, according to a police report filed in court. Williams and his two companions were apprehended nearby on Glenway Street, Lee said.

Ballistic testing tied the bullets fired at Jaffier and Fulton to the revolver recovered from the yard, Lee said.

“The projectile that struck Miss Fulton was recovered where she was sitting,” Lee said. That bullet, as well as the one removed from Jaffier’s body, matched the gun recovered in the yard, he said.

Defense attorney John M. Galvin did not contest prosecutors’ request that Williams be held without bail, but asked to reserve the right to seek bail later.

Outside court, Galvin said many of Williams’s family members attended his arraignment. He declined to comment further. Williams is scheduled to be back in court Oct. 14.

Meanwhile, Jaffier’s friends and family continued to grieve.

At the news conference, Mayor Martin J. Walsh and Evans said they met Monday with Jaffier’s family, who first sought the public’s assistance in solving her killing within hours of her death.

“This weekend we lost a young woman who was in the right place for her to be,’’ Walsh said. “She lost her life by somebody taking a shot. The senseless violence in the city of Boston has to stop. . . . Help us get the guns off the street.

“We can’t bring back this young, beautiful woman who has given so much,” Walsh said. “We are not going to let her memory be forgotten.’’

Jaffier’s friends said she had participated in the Caribbean festival for the last eight years because it fed her passion for dance and honored her heritage.

Anim Aweh said she planned to be with Jaffier for the J’ouvert parade, but overslept. She later got a call alerting her that something had happened to Jaffier.

“She died doing something she loved,” said Aweh, who met Jaffier when they attended Jackson/Mann K-8 School. “She was a selfless person who would give and give and give.”

Jaffier spent the last several years working at the James W. Hennigan Elementary School, where she was a beloved figure known as Coach Dawnn. Principal Maria Cordon said Jaffier stood out by wearing colorful tights, black-and-white sneakers, a Michael Jackson sequin glove, and glitter in her hair.

“She had a connection with so many children,” Cordon said. “I loved that girl. I loved her.”

Shantell Jeter, 26, who met Jaffier at a summer camp when they were 8 years old, said she’s comforted her friend got a chance to participate in one last Caribbean festival.

“She loved to dance,” Jeter said. “I’m glad she got to dance one last time.”

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.