A 22-year-old man was shot several times and a 14-year-old boy was struck in the leg Thursday afternoon when a shootout spilled into a Federal Donuts shop in Northern Liberties, according to police.

The incident began around 1 p.m., when two gunmen near the 700 block of Fairmount Avenue chased after and shot at the 22-year-old, Commissioner Danielle Outlaw said at the scene.

As the man ran into the Federal Donuts shop to try to avoid the gunfire, Outlaw said, the 14-year-old — who was sitting inside with his family — was struck at least once in the crossfire.

The 22-year-old, whom police did not identify, was struck several times and taken to Thomas Jefferson University Hospital in critical condition. Outlaw said police hadn’t determined if he was shot inside or outside the store.

The teen was also taken to Jefferson in stable condition, police said.

No one was arrested. Detectives were reviewing surveillance footage and investigating whether a vehicle found nearby was left by the shooters, according to Outlaw. She said officers recovered a gun but didn’t know yet whose it was.

A police source said officers were investigating whether the crime was in retaliation for a shooting a few blocks away the night before, when a 30-year-old man was shot in the back on the 800 block of North 10th Street and hospitalized in critical condition.

In Thursday’s incident, several employees were inside the shop as shots rang out, as were the 14-year-old, his relatives, and another customer, the commissioner said.

”There’s a lot of people that were impacted,” she said. “And these shootings have an impact on the community, because they walk by and they’re reminded of what occurred here … these incidences are traumatizing and we don’t want this to become the norm.”

The shooting came as violence has continued to surge in the city. Between 10 p.m. Wednesday and 2:30 a.m. Thursday, police said, seven people were shot, two fatally.

Already this year, 236 people have been killed in homicides in the city — 33% more than through this date last year, and the highest year-to-date total since at least 2007.