Opposite the Åhléns department store on Drottninggatan, the smell of smoke still hanging over central Stockholm gave way to the fragrance of flowers.

Swedes had festooned the high police barriers opposite the store with red and white roses. In place of the usual roar of cars there was a stillness broken only by the sound of seagulls and hushed voices.

A crowd had gathered to pay its respects to the four people who lost their lives there on Friday afternoon, when a lorry careered down the busy shopping street and smashed into the store windows, where it caught fire. Nine people were still in hospital with serious injuries on Saturday.

It could easily have been many more. Moments before the attack, schoolchildren had been selling flowers to raise money for an annual charity campaign. Traffic wardens were among the first on the scene to try to save the dying. A woman with a broken neck passed away in a man’s arms.

Rakel Ekendahl, 26, was at her office nearby when a colleague’s sister called in hysterics, screaming about blood and body parts. “We panicked,” she said. “We all got together in one room away from the windows, and watched the news. Then the rumours started.”

Suddenly there were reports of shootings all over the city. People hid wherever they could. Rightwing websites spread the name and photo of a man who later said on Facebook that he had had no contact with the police and was entirely innocent.

Ekendahl had returned to the centre of the city on Saturday “to show we care and are united and not afraid”, she said. “Stockholm is quite a small city, you always know someone who knows someone, so everyone is affected.”

During the course of Saturday, police became increasingly convinced that the 39-year-old Uzbek they had seized in a northern suburb around midnight was indeed the truck driver behind the carnage. Police sources said an unexploded bomb had also been found in the cab.

Flowers and candles at a makeshift memorial near the Stockholm attack site. Photograph: Jonathan Nackstrand/AFP/Getty Images

Officers said they were working on the assumption that the attack was terrorism similar to the past year’s events in Nice, Berlin and last month in London, when lone Islamist radicals hijacked vehicles and drove them at pedestrians.

Sweden’s leaders searched for words that have now become a grimly familiar message of defiance in response to these attacks. “The terrorists can never defeat Sweden. We will not be subjugated,” the prime minister, Stefan Löfven, said.

But political clashes over the tragedy are unlikely to be far off. Critics of the government accuse it of creating a haven for Islamist fanatics. The mood of generosity towards asylum seekers had started to turn in 2015, after the shootings in Paris that left 130 dead. The country tightened border controls in January 2016.

However, 163,000 refugees were still allowed into the country that year and critics claimed that Sweden was importing Islamist extremism. Several hundred Swedes have joined Islamic State militants in recent years, making the country second only to Belgium as a source of European recruits to the “caliphate”.

“I can understand why people are asking whether Sweden has been too open, even naive,” said Anna Carlstedt, Sweden’s national coordinator against violent extremism.

Sweden had been relatively free of Islamist violence until now, Carlstedt pointed out. The last attempt at terror, which took place near the same spot in Stockholm at Christmas 2010, ended with an Iraqi al-Qaida bomber killing himself, but injuring no one else.

“This open, tolerant and democratic society is extremely important to us, it is in our blood, in our souls,” Carlstedt said. “There are voices asking, ‘can Sweden continue to be like this?’ I understand why people ask these questions, but at the same time we need to be extremely careful and ask ourselves, is it true that countries with very repressive policies and legislation have been spared?”

The flow of Isis recruits from Sweden has now ceased, as Isis has lost territory and crossing Turkey’s border with Syria has become much more difficult. But some 110 people have returned to Sweden after going there to fight.

According to Christer Mattson, head of the Segerstedt Institute in Gothenburg, set up two years ago to combat extremism, spotting individuals at risk of extremism was like finding needles in a haystack, so Sweden was developing methods to “remove the hay”. While a common factor is poverty and marginalisation from mainstream society, experts are waking up to the importance of hyper-local approaches to radicalisation.

“It has taken decades to understand that if you want to target violent groups you have to go where there they are,” said Mattson, a close friend of whom was injured in Friday’s attack.

He added: “We talk about the importance of the global or national situation, but unless you know what is going on in local areas you cannot adopt any sort of effective methodology.”

The area of Gothenburg most notorious for radicalisation is the improbably named Angered. “In urban areas radicalisation may be happening street by street or block by block. Unless you focus on the right area you will miss the target,” Mattson said.

Sweden’s efforts have come in for criticism. Carlstedt is the third national coordinator against violent extremism in less than a year; a previous incumbent quit after a corruption scandal and then her successor said she couldn’t cope with the mess she inherited.

One national newspaper in December called her agency a “fiasco”, a prestige project that had gone off the rails. Carlstedt herself admitted that information-sharing between agencies had got to improve.

“The anti-radicalisation programme in Sweden has been a joke. Nobody answered the phone and funds went to questionable activities without any effect, while the police and social services didn’t share information,” said Klas Nilsson, a private security consultant in Stockholm.

“I think people are more and more aware that the current politics are leading Sweden down a dangerous path, and that next year’s election will likely be a wake-up call to many – like the US election last year.”

Indeed, the name of President Donald Trump was on everyone’s lips following Friday’s terrible events. The Stockholm killings come just two months after Trump was widely ridiculed for referring to a non-existent terror attack in Sweden.

Among the crowds at Drottninggatan yesterday on Saturday, Joakim Berggren said he feared the moment now when Trump would say something about Sweden.

“I am so afraid of it – one of the worst things when these things happen is that all the dark forces get the wind in their sails,” said Berggren, 32, who runs an events company. “Trump will come out and say ‘I told you so’, and we don’t need that, humanity doesn’t need that.”

Sweden has its own rightwing populists, the Sweden Democrats, who are level-pegging with the centre-right Conservatives to be the largest party in opposition to the centre-left government of Social Democrats and Greens.

“They work exactly like Trump, scaring people, and these days it is really easy to do that,” Berggren said. “Is immigration to blame for terrorism? Absolutely not. We are all in this together.”