Swedish police say the man suspected of carrying out Friday's truck attack had been facing deportation.
A second man has also been arrested in connection with the attack in Stockholm.
Meanwhile, investigators have confirmed the fatal victims were a British man, a Belgian and two Swedes.
They were knocked down by a lorry that was driven through a busy shopping area.
Jonas Hysing, national head of police operations, says the authorities had been trying to deport the main suspect:
At Sergels Torg, Stockholm, with tens of thousands of others, & my family, to be part of a demonstration of love & solidarity #openstockholm pic.twitter.com/gWqWIK6WK0
— Alan AtKisson (@AlanAtKisson) April 9, 2017
Thousands of Swedes have gathered for a vigil in Stockholm for those who were killed in Friday's attack.
A moment's silence is being held at 2.53pm - the time the attack happened two days ago.
Meanwhile, police in neighbouring Norway have arrested a man following the discovery of a suspected bomb in the capital Oslo.
A controlled explosion was carried out on the device found at a Metro station in the centre of the city.
