An Uzbek man who plowed through a crowd in Stockholm last year with a stolen truck -- killing five people in what he said was a revenge attack for Sweden fighting against ISIS -- will now spend the rest of his life in prison.

Rakmat Akilov was convicted Thursday of terror-related murder and given a life sentence for the April 2017 attack, which left a British man, a Belgian woman and three Swedes, including an 11-year-old girl, dead.

Akilov had said he wanted to punish Sweden for joining a coalition against the Islamic State group.

Judge Ragnar Palmkvist said Akilov, 40, was the only suspect in the attack, and that prosecutor Hans Ihrman called him a "security risk to society" during his trial at the Stockholm District Court.

The prosecution had demanded a life sentence while defense lawyer Johan Eriksson said his client had been cooperative throughout the investigation and should be given a time-limited sentence.

During the court proceedings that started Feb. 13 and ended ending May 2, Ihrman said that "Akilov took the right to determine the fate of so many people. Now it is the turn of the democratic rule of law to determine the fate of Akilov."

After plowing the stolen beer truck into a crowd of shoppers on a busy shopping street and crashed into the upscale Ahlens department store in Stockholm's city center, Akilov also planned to blow himself up. He failed, and caused a smaller explosion inside the truck when a suspected bomb made of five gas canisters with dozens of screws, blades and smaller metal objects went off.

Akilov then escaped via Stockholm's subway system but was arrested hours later in a suburb.

He was found guilty of five counts of terror-related murder, 119 counts of attempted murder and 24 cases of endangering the life of others.

The Associated Press contributed to this report.