"We know that he showed interest for extremist organisations like IS," police chief Jonas Hysing told reporters, adding that two Swedes, one Briton and a Belgian were killed in the attack.
The suspect, who has only been officially identified as a 39-year-old man from Uzbekistan, "applied for a permanent residency permit in 2014," Hysing said.
"The Migration Agency rejected it in June 2016 and also decided that he was to be expelled," he added.
"In December 2016, he was informed by the Migration Agency that he had four weeks to leave the country. In February 2017, the case was handed over to the police to carry out the order, since the person had gone underground," he said.
More From This Section
On Friday, the suspect is alleged to have barreled a stolen beer truck several hundred metres (yards) down the bustling pedestrian street Drottninggatan in the heart of Stockholm.
The vehicle mowed down shoppers before slamming into the facade of the busy Ahlens department store.
The motive for the attack is not known.
Thousands of people were to gather in central Stockholm on Sunday for a "Lovefest" vigil against terrorism.