(Sarah Parnass,Dani Player/The Washington Post)

Swedish police said Saturday that they believe they have captured the man accused of turning a beer truck into a weapon a day earlier by driving it into a crowd of pedestrians in a rampage that left four people dead. 

Authorities did not divulge the man’s name but said he is a 39-year-old from Uzbekistan who had been known to security services as “a marginal character” for the past year. Police said that when they first investigated him, they had found no connections to extremism. Authorities did not say when the man had come to Sweden.

The arrest came Friday night when officers apprehended a suspect in the northern Stockholm suburbs who matched the description of a man seen in surveillance footage earlier in the day. Police initially said they were unsure whether the man they had arrested was involved in the attack. 

But their confidence grew overnight, and in an early afternoon news conference Saturday, authorities said they were all but certain that they had caught the assailant.

Swedish Prime Minister Stefan Lofven said Friday that the attack was “an act of terrorism,” although officials have not commented on an exact motive.

Swedish media outlets reported Saturday that there was a homemade explosive device discovered in the mangled wreckage of the truck, which was towed overnight from the upscale shopping district that on Friday afternoon became a scene of carnage. 

National Police Chief Dan Eliasson said that “a device that did not belong there was found in the truck.” But officials said it was unclear whether it was a bomb.

Flags across Stockholm flew at half-staff Saturday, and mourners paid respects by leaving flowers at the scene of the attack.

Among them were Crown Princess Victoria and her husband, Prince Daniel. With tears in her eyes, Victoria said she was filled with “sadness and emptiness.”

In nationally broadcast remarks, King Carl XVI Gustaf — who returned home from a visit to Brazil following the attack — said his thoughts “go out to the victims of this abhorrent deed, fellow humans who have been injured and killed.” 

Politicians across the spectrum also paid tribute to the dead, and many expressed backing for the prime minister’s handling of the incident. A Facebook-organized remembrance for the victims is due to be held near the scene of the crime on Sunday.

With the attack, which also injured 15 others, Stockholm joined a growing list of major European cities where vehicles have been turned into weapons over the past year, including Nice, France, Berlin and London.

Despite the growing frequency of such attacks, security officials say there are few obvious solutions because it is nearly impossible to stop an assailant determined to drive into pedestrians. 

Fredrik Reinfeldt, a former Swedish prime minister, told the BBC on Saturday that the country would continue to try to thwart such attacks, but would not compromise its values.

“We are preparing, we understand the risks,” he said. “But we are not willing to close down the openness that is the flare of freedom that we love so much.”