An Uzbek asylum seeker who confessed to wanting to mow down "infidels" in an April 2017 Stockholm truck attack that killed five people has pleaded guilty to terrorism charges as his trial opened.

Rakhmat Akilov, whose Swedish asylum application had been rejected in 2016, had sworn allegiance to the so-called Islamic State group on the eve of his assault, though the jihadist group never claimed responsibility.

On the afternoon of Friday 7 April, Akilov stole a beer delivery truck and drove down a bustling pedestrian shopping street, swerving wildly to hit as many people as possible.

He killed five and injured ten before fleeing the scene.

He was arrested several hours later thanks to public transport video surveillance images and later confessed in police questioning.

"Akilov took the truck... and drove it the way the prosecutor described. He killed five people and physically injured ten.

"The motive was to instigate fear and to get Sweden to end its participation in the coalition against the Islamic State," defence lawyer Johan Eriksson told the court.

Akilov fled the scene and was arrested several hours later thanks to public transport video surveillance images.

He confessed in police questioning.