An Uzbek man who carried out a deadly attack in Stockholm last year swore allegiance to the Islamic State group in a video and wrote that he wanted “to scare the infidels and leave my life”, prosecutors have said.

Rakhmat Akilov went on trial on Tuesday at Stockholm District Court for ramming a stolen truck into a crowd in the Swedish capital, killing five people and injuring 14 others because he wanted to punish Sweden for joining a coalition against IS.

He is charged with terror-related murder and attempted murder.

The prosecution has asked that he gets a life sentence and is extradited from Sweden.

Stockholm truck incident
The scene of the attack in in Drottninggatan in the centre of Stockholm (Arash Pendari/PA)

Akilov, who has confessed to the attack, wore handcuffs as he entered the high-security courtroom.

Prosecutor Hans Ihrman described how Akilov drove a stolen beer truck into a busy Stockholm shopping street on April 7 before being arrested hours later.

“The case is about 40 seconds that changed forever the lives of those who were on Drottninggatan” promenade that day, he said.

Five people were killed — a British man, a Belgian woman and three Swedes, including an 11-year-old girl.

The Briton, Chris Bevington, 41, worked as a director with music streaming service Spotify and was based in Stockholm with his family.

“Yes, it was Akilov who drove the truck,” his lawyer Johan Eriksson told the court.

In a room next to the courtroom, relatives of the victims listened quietly, some in each other’s arms.

Akilov, who turns 40 on Wednesday, was born in Uzbekistan and worked there as a construction worker.

He arrived in Sweden in 2014 and applied for asylum, claiming he had been persecuted. His application was rejected and he was ordered to leave in December 2016.

Instead, he went underground, eluding authorities’ attempts to track him down. Sweden’s domestic intelligence agency has said it had nothing indicating he was planning an attack.

Stockholm truck incident
Video grab of the scene from the Facebook page of Linus Friden (Linus Friden/PA)

Inside the courtroom, Akilov stared at a screen where footage from the attack — including film he shot while driving the truck — was shown.

The prosecutor said Akilov used 53 sim cards and social media — including WhatsApp, Telegram, Viber, Facebook and Zello — to communicate with others about his activities.

Akilov has said he proposed carrying out an attack in Stockholm to IS on their behalf. It was not clear whether the group accepted his offer.

Investigators have found internet chat logs with unknown people in which Akilov discussed becoming a martyr and swore allegiance to IS between January 12 2017 and the attack.

They have also found a memory card with execution videos and thousands of photos, including one of IS leader Abu Bakr al-Baghdadi.

The prosecution also played a video where Akilov swore allegiance to IS. On April 6 — the eve of the attack — he wrote in a chat: “Tomorrow, in the evening I will find a large vehicle and I will drive into a crowd with it.”