A Finnish court on Friday sentenced a Moroccan asylum seeker to life in prison over what was described as the nation’s first terror attack after he killed two women and injured eight others in a stabbing spree last year.

The district court of Southwestern Finland found Abderrahman Bouanane guilty of two murders and eight attempted murders “with terrorist intent” in the southern Finnish city of Turku on the afternoon of August 18, 2017.

The court said in its verdict that the 23-year-old swore allegiance to the Islamic State group (IS) in a video uploaded the night before the attack at a market place. The extremist group never claimed responsibility for the assault.

Police shot the rejected asylum seeker in the thigh minutes after the attack at another square nearby, arresting him and confiscating his knife.

The murders “were strongly premeditated and committed in a particularly brutal and cruel way,” the court said, adding Bouanane “was about to cut off the victim’s head”.

Authorities said he targeted women in the attack. Six of the total injured were women, while two men were wounded when they tried to fend off the attacker.

Bouanane, who confessed to the killings, has 30 days to appeal the verdict.

A life term in Finland averages 14 years, although the longest prison term has been 22 years.

The court also ordered Bouanane to pay compensation to the survivors and to the victims’ families, totalling more than 470,000 euros ($546,000).