RALEIGH, N.C. (AP) — A 15-year-old boy began shooting in the streets of a middle class Raleigh neighborhood, then fled toward a popular walking trail where he opened fire in an attack that left five people dead, two injured and authorities searching for a motive, police said Friday.

Raleigh Police Chief Estella Patterson said the teen was captured hours after the Thursday evening shooting. He was hospitalized and in critical condition following his arrest. Authorities have not said how he was injured.

The victims were different races and ranged in age from 16 to their late 50s, Patterson said. Family members and friends said they were gunned down while doing normal, everyday activities — an off-duty police officer was killed while on his way to work, one of the women who was killed was on her porch talking to a neighbor, and another woman who died was out walking her dog.

The teen, who was not immediately identified by police, eluded officers for hours — setting off a manhunt across a crime scene that stretched for 2 miles (3 kilometers) — before he was cornered in a home and arrested, Patterson said.

Gov. Roy Cooper called the shooting an “infuriating and tragic act of gun violence.”

“Today we’re sad, we’re angry and we want to know the answers to all the questions,” Cooper said. “I think we all know the core truth — no neighborhood, no parent, no child, no grandparent, no one should feel this fear in their communities — no one.”

The gunfire broke out around 5 p.m. Thursday in a residential area northeast of downtown, Raleigh Mayor Mary-Ann Baldwin said. Officers from numerous law enforcement agencies swarmed the area, closing roads and warning residents to stay inside while they searched for the shooter.

The Hedingham neighborhood, where the shooting began, is a residential area of single family and town homes, as well as a golf club. The Neuse River Greenway, a walking and biking trail, runs just behind houses in the neighborhood. The trail runs about 27 miles (43 kilometers) along the river and connects to the state’s Mountains-to-Sea Trail that’s popular with thru-hikers. The stretch behind the neighborhood is paved and lies down a grassy slope from the houses.

Police say Officer Gabriel Torres, 29, was among the five killed. He was off-duty and on his way to work when the shooting began. The other victims were Nicole Connors, 52; Mary Marshall, 34; Susan Karnatz, 49; and James Roger Thompson, 16. Connors’ husband told The Associated Press she was on the porch and talking to a neighbor when she was killed. Marshall’s sister told NBC News that she was out walking her dog, Scruff.

Marcille Lynn Gardner, 59, was talking to Connors when she was shot. Gardner remained hospitalized in critical condition Friday. A second police officer, Casey Joseph Clark, 33, was also wounded and released from the hospital.

Karnatz’s husband, Tom Karnatz, said she was an avid runner who often ran on the greenway.

“She was a very loving wife and amazing mother to our three sons,” he said through tears when he answered the door at the family’s home Friday. “We’re absolutely heartbroken and miss her dearly.”

In the driveway, a silver minivan and a Toyota Camry had matching 26.2 stickers — symbolizing the miles of a marathon. The minivan’s license plate read simply: “RUNNR.”

Woodrow Glass, a 74-year-old retiree and neighbor of Connors, said he talked to her nearly every day as she walked her small dog.

“She was friendly with everybody in the neighborhood, spoke with everybody … and was really respected here. And we’re going to miss her,” he said.

Baldwin said the shooting has brought home the need to “end senseless gun violence that has grips on our country and now on our city.”

“We have to do something,” she said.

In a statement Friday, President Joe Biden said he and First Lady Jill Biden are grieving with victims’ families, and his administration is working closely with Cooper to help local authorities with their investigation.

“We are thinking of yet another community shaken and shattered as they mourn the loss of friends and neighbors, including an off-duty police officer,” he said, adding: “Enough. We’ve grieved and prayed with too many families who have had to bear the terrible burden of these mass shootings.”

Omer Rosas, a sophomore at Knightdale High School, said he was shocked to learn Friday that his classmate was arrested in connection with the shooting.

“I did not expect it to be him,” Rosas told the AP. “He was very calm. He wasn’t like a mean person. He was open to be nice to everyone.”

Rosas said the teen is personable and athletic — a smaller guy who enjoys running and was considering joining the school’s track team.

Under North Carolina law, crimes committed by 15-year-olds are usually adjudicated in juvenile court. But a juvenile court judge must transfer a case to Superior Court for a youth to be tried as an adult if a 15-year-old is accused of first-degree murder and the judge determines there is probable cause that the teen committed the crime. Authorities have not commented on what charges the teen could face.

The Raleigh shooting was the latest in a violent week across the country. Five people were killed Sunday in a shooting at a home in Inman, South Carolina. On Wednesday night two police officers were fatally shot in Connecticut after apparently being drawn into an ambush by an emergency call about possible domestic violence. Police officers have been shot this week in Greenville, Mississippi; Decatur, Illinois; Philadelphia, Las Vegas and central Florida. Two of those officers, one in Greenville and one Las Vegas, were killed.

Thursday’s violence was the 25th mass killing in 2022 in which the victims were fatally shot, according to The Associated Press/USA TODAY/Northeastern University Mass Killings database. A mass killing is defined as when four or more people are killed excluding the perpetrator.

The walking trail was quieter than usual Friday. Sara Cutter, 31, said she sensed “a lingering sadness over Raleigh” as she walked the greenway, about a mile from the shootings. She said the shooting won’t deter her from using the trail, but she will be more vigilant and probably won’t walk alone anymore.

“We’re all hurting today, the entire city,” Cutter said. “I’ve seen some somber faces while I’ve been out walking today. But it’s also been good to see people out. The community — that’s what will get us through.”