Police shot and wounded the knife-wielding suspect, detaining him minutes after Friday’s rampage at a busy market square in Turku, southwestern Finland.
Eight other people were injured, among them six women, police said.
Finland raised its emergency readiness after the attack, increasing security at airports and train stations and putting more officers on the streets.
“We think that the attacker especially targeted women, and the men were wounded after coming to their defence,” superintendent Christa Granroth of Finland’s National Bureau of Investigation told reporters.
Four Moroccan citizens were arrested in a Turku apartment and refugee reception centre overnight. They have links to the suspect, but police have not yet established whether they were connected to Friday’s attack.
The stabbings were initially probed as murders but further information received meant “the offences now include murders with terrorist intent,” police said in a statement.
Officers identified the main suspect as a 18-year-old Moroccan citizen who arrived in Finland in early 2016 and sought asylum. His name was not disclosed, nor his motive known.
“We tried to talk with the attacker in hospital but he didn’t want to speak,” Granroth said.
The suspect is being treated for a gunshot wound to the thigh.
Media reports said his asylum request had been rejected but police would not confirm this, saying only that his case had been processed by migration authorities.
Police said they were examining whether the suspect had any link to the Islamic State group, which claimed responsibility for twin terror attacks in Spain on Thursday and early Friday.
“Whether or not there is a connection to IS will be one of the main focuses of the investigation,” Finnish intelligence agency SUPO director Antti Pelttari told reporters.
– Barcelona link? –
Police said they had issued an international arrest warrant for another person outside Finland, who is believed to be dangerous.
Police were also probing whether there was a link to the vehicle attacks in Barcelona and another Spanish seaside resort that killed 14 people and wounded around 100 others.
Most of the suspects in those attacks were also Moroccan citizens. “Of course this is something we are going to investigate,” Granroth said.
Among the eight injured in Turku were an Italian national, a Swede and a Briton. The rest were Finns.
In June, SUPO raised Finland’s terror threat level by a notch, from “low” to “elevated”, the second on a four-tier scale.
It said at the time that it saw an increased risk of an attack committed by IS, noting that foreign fighters from Finland had “gained significant positions within IS in particular and have an extensive network of relations in the organisation.”
The agency said it was closely watching around 350 individuals — an increase of 80 percent since 2012.
Experts were cautious about drawing any links between the attack and Islamist extremism.
“But if it is related, this is pretty much a continuation of the easy-to-use blatant attacks that Europe has seen,” terrorism researcher Leena Malkki from the University of Helsinki told public broadcaster YLE.
– Flags at half-mast –
Flags flew at half-mast across Finland on Saturday.
A demonstration in memory of the victims was held at the market square where the attack took place, organised by Iraqis, Turks and Syrians.
An anti-immigration group, Finland First, also demonstrated at the scene, but police kept apart the two groups, who numbered around 300. No violence was reported.
On Sunday, a minute of silence will be held at 0700 GMT.
Finland, with 5.5 million inhabitants, saw a record 32,500 migrants seek asylum in 2015.
That number fell to around 10,000 last year, after Finland, like its Nordic neighbours, tried to discourage asylum seekers by tightening rules and reducing social benefits.
Download our app and read this and other great stories on the move. Available for Android and iOS.