BROOKLYN — A candlelight vigil to mourn a 16-year-old boy who was fatally shot by police turned violent Monday evening, as frustrated attendees threw bottles at cops, broke shop windows and looted a Rite Aid, officials and sources said.

The 7 p.m. vigil started with heartfelt remembrances of Kimani Gray — who was shot and killed by two police officers in East Flatbush Saturday night after he allegedly pointed a .38 caliber pistol at them — but soon some of the teens at the vigil grew violent and began throwing trash cans, people who attended the event said.

By 8:30 p.m., "a large, disorderly group [began] throwing bottles at police" at Church Avenue and East 48th Street, a few blocks from the vigil, an NYPD source said.

As riot police filled the streets, the crowd also surged into the Rite Aid on Church Avenue near Albany Street and trashed it about 9:15 p.m., pulling items off the shelves and attacking the store manager, clerks, security guard and a customer, officials said.

The group attacked the 51-year-old customer with a wine bottle and punched him, police said. He was rushed to Kings County Hospital while bleeding from his head, fire officials said.

The group also allegedly stole the man's cell phone and items from the store.

"They just ran in and started knocking everything down. There were water bottles in the streets. Then they ran down the block and started ransacking," said Spencer Nurse, 24, who was across the street from the Rite Aid as the scene unfolded.

"I don't understand it. Doing that is not going to bring the person back."

Some surrounding shop windows were smashed, other sources said, as were the windows of a B35 bus, the MTA said, adding that no one connected with the bus was hurt.

Sandra Mitchelin, 42, a community member who helped organize the vigil and said Gray was "like my son," said the teens grew violent because they were disappointed that no elected officials initially attended the vigil.

“The kids, they retaliate because they want their voice to be heard," Mitchelin said. "They're frustrated. Not even the police commissioner or the mayor. Nobody came out... And he was a baby!”

After the violence broke out Monday night, City Councilman Jumaane Williams raced to the scene to try to calm the crowd.

"I'm in the middle of the riot action at Church and Snyder in my district," Williams tweeted. "Right now, things are tense. Young people have expressed anger."

Williams estimated the crowd at 60 to 100 people and said he was "trying to defuse the tension."

"Tonight was a peaceful vigil [for Gray] that devolved into a riot," Williams added. "The youth in this community have no outlets for their anger, no community center."

One person was arrested and charged with disorderly conduct, an NYPD spokeswoman said. No police officers were injured, the spokeswoman added.

Gray, of Crown Heights, was with a group of teens on East 52nd Street near Snyder Avenue about 11:25 p.m. Saturday when two anti-crime patrol officers approached in an unmarked car, the NYPD said.

The officers noticed that Gray was acting strangely and fidgeting with his waistband, police said. When they got out of their car and tried to speak to Gray, he turned on them and pointed a pistol at them, police said. Both officers fired, striking Gray in the legs and torso, the NYPD said.

Gray was rushed to Kings County Hospital, where he was pronounced dead.

“The whole community is fed up," said Mitchelin, who has a 14-year-old daughter who went to school with Gray. “They come out and attack these kids like they're gang bangers.... These were 13, 14, 15-year-olds at a party. It never deserved to go down how it went down."

“We need to have an investigation," Mitchelin added. "We need somebody to say something."

On Monday night, the violence just a few blocks away from where Gray was shot had ended by about 10:15 p.m., but the crowd remained for at least another hour, until organizers announced that the protest was over for the evening and would resume the following day.

The next demonstration was scheduled to begin at 8 p.m. Tuesday at East 55th Street and Church Avenue.

With reporting from Elizabeth Barber.