“The sum may seem low — we realize that,” he said. “This is a unique situation, and we have looked at the concrete danger in each case. If the person was one to two meters away from the truck, it is deemed attempted murder. If the person is farther away, it is considered endangering a life.”

Mr. Akilov, a welder from Samarkand, Uzbekistan, applied for asylum in November 2014, but was rejected and told to leave. (It is unclear when he entered Sweden.) When his appeal was also rejected, he went underground, working in construction around Sweden. The authorities could not find him to deport him.

The police said that they had looked for Mr. Akilov in February last year but that he had already gone underground. Even if he had been found, however, it would have been difficult to deport him because of the poor human rights situation in Uzbekistan, Patrik Engstrom, the head of the Swedish border police, told The New York Times last year.

Shortly before 3 p.m. on April 7, 2017, Mr. Akilov, then 39, hijacked a delivery truck parked in central Stockholm and turned on to a busy shopping street, Drottninggatan. Then, in a 40-second terror spree, he mowed down and killed five people and injured almost a dozen others before he crashed into a department store.

He tried to detonate a homemade bomb in the truck before fleeing the scene, Judge Palmkvist said. Hours later, the police arrested Mr. Akilov in a suburb north of Stockholm. He immediately admitted to the attack, the authorities said.

Three people were killed immediately; two died later in hospital. Those killed included Ebba Akerlund, 11; Lena Wahlberg, 69, a retired teacher; Marie Kide, a 66-year-old Swede; Crispin Benvington, 41, a Briton who worked for the music streaming service Spotify in Stockholm; and Maïlys Dereymaeker, 31, of Belgium, who was visiting the city.

A few hours before the terrorist act, Mr. Akilov filmed himself on his mobile phone swearing allegiance to the Islamic State and saying, “It is time to kill,” the police said.