(Sarah Parnass,Dani Player/The Washington Post)

Sweden’s capital became just the latest major European city to transform into a scene of vehicle-borne carnage Friday as a stolen beer truck slammed into a crowd of pedestrians outside an upscale shopping center, killing four in an assault that the prime minister denounced as a terrorist attack.

The driver apparently escaped the smoky and blood-streaked scene, police said. Throughout the afternoon and evening, he was the subject of an intensive manhunt as helicopters searched from the skies, heavily armed officers were deployed through normally tranquil neighborhoods and security at borders was tightened. For hours, the city’s transit system was shut down and streets in the central district were sealed off.

Police said Saturday they had arrested a man who is “likely” the driver of the truck, according to the Associated Press.  A person has been formally identified as a suspect of “terrorist offenses by murder” and should face a pre-trial custody hearing before midday Tuesday or be released, Swedish prosector Hans Ihrman told AP.

In addition to the four people killed, police said that at least 15 had been injured.

Authorities did not speculate as to the attacker’s motives and offered no details about the man they had arrested. But Prime Minister Stefan Lofven said that the midafternoon rampage had been “an act of terrorism” and that the government would do “whatever it takes” for the public to feel safe. 

“Terrorists want us to be afraid, to not live our lives normally,” he said in an evening news conference. “Terrorists can never defeat Sweden, never.” 

Behind the tough words, however, was an acknowledgment from security officials that attacks like Friday’s — so similar in means and execution to other assaults carried out with vehicles over the past year in the French city of Nice, and in Berlin and London — are nearly impossible to stop.

“There is no way to really prevent this kind of thing,” said Stefan Hector, an official with Sweden’s national police.

Until Friday, Sweden had been spared the sort of mass-casualty attacks that have afflicted other countries across Europe in recent years. The attack was the first major apparent terrorist strike in Stockholm, a peaceful city set among peninsulas and islands near the Baltic Sea.

It underscores a growing vulnerability that Sweden had long ignored, said Magnus Ranstorp, a terrorism researcher at the Swedish Defense University. “Sweden had been somewhat like an ostrich,” Ranstorp said. “People were reluctant to talk about it and admit there was a problem.”

That has changed recently as the country has become more aware of the threat, he said. Just in the past week, police had even conducted training on a scenario much like the one that unfolded in reality Friday. 

Previous attacks in Europe have been claimed by the Islamic State terrorist group. Although the group’s involvement in such attacks has often been tenuous at best, authorities in several cases have said they think the attackers were inspired by extremist Islamist propaganda.

Ranstorp said that Sweden has a problem with Islamist extremism and far-right extremism, and that Friday’s attack will inflame tensions no matter who was responsible. 

“Now it’s not something far away, in Nice or in Berlin. It’s come home,” he said. “That will have consequences.” 

The mood in Stockholm on Friday night remained tense even as trains and subways resumed their normal schedules, with police warning the public to be vigilant.

The arrest of the man later identified as the driver followed the distribution of a grainy surveillance photo showing a man in a hoodie.

“We have arrested a person who is of interest to us. We also released an image of a person we were looking for. The person arrested matches this description,” said Jan Evensson of the Stockholm police. “But police are still on the alert.” 

The assailant’s rampage apparently began with an idling truck.

Rose-Marie Hertzman, a spokeswoman for the Swedish brewery company Spendrups, said the truck used in the attack was stolen from one of the firm’s drivers about 2:30 p.m. — about a half-hour before the rampage.

“The driver was unloading, and a man came running and took the truck and drove away,” she said.

Minutes later, the force of the truck crashing into the upscale Ahlens City retail hub sparked a fire and sent smoke billowing above one of the city’s premier shopping districts. One witness described seeing a woman with a severed foot and people either running in panic or staying to help amid pools of blood.

Gahangir Sarvari, 56, an Iranian refugee, was about 50 yards from the attack and said he initially thought it was a traffic accident. Then he saw the trail of carnage, which included a young woman whose legs were severed.

“I can never forget when we made eye contact,” he said. “I was screaming at people why they didn’t call the police and screaming at people who were taking photos with their phones. I didn’t know what to do.”

The attack occurred on a mild spring afternoon, when the city’s central district is customarily buzzing with shoppers, office workers and bicyclists. Its impact quickly rippled across the city. Shoppers were locked inside stores after businesses triggered their automatic security systems. Police evacuated Stockholm’s central train station and shut down the subway.

In a sign of the expanding dragnet, Swedish authorities requested limits on traffic flow to better scan vehicles crossing the Oresund Bridge connecting Sweden and Denmark — and the route into the continent with its many open borders under the European Union’s free-movement treaty.

The attack comes just a little over two weeks after a man plowed an SUV into a crowd of pedestrians on a London bridge, then stabbed a police officer at the gates of Parliament. That assailant killed five, including a woman who died Thursday of injuries she received when she was knocked off the bridge and into the River Thames.

Last year, trucks were also used in deadly rampages through crowds at a Berlin Christmas market and along Nice’s waterfront during France’s Bastille Day in July.

As news of the Stockholm attack spread, there were expressions of resolve from across Europe but few concrete ideas for how to stop the wave of deadly assaults.

“We stand in solidarity with the people of #Sweden,” wrote European Commission President Jean-Claude Juncker on Twitter. “An attack on any of our Member States is an attack on us all.”

Witte reported from London. Brian Murphy in Washington and Karla Adam in London contributed to this report.