Police in Gothenburg, Sweden rushed to the refugee centre after an employee spotted a suspicious object.
Housing around 140 migrants, all residents were swiftly evacuated and a cordon set up around the package while explosive experts investigated.
The bomb squad confirmed the object contained “some form of explosives”.
Peter Adlersson, spokesman for the police force, called it a serious incident and added an investigation had been launched.
The device was safely detonated and residents, many of whom were out at the time, were allowed to return.
No arrests have been made so far.
The town has been rocked by recent attacks, after gangs of migrants have marauded through the local shopping mall in Nordstan.
Officers have been on high alert after multiple reports from shoppers that the packs of migrants harass and attack them, forcing many to stay away.
The brewing trouble usually spills over in the evening when the shop are beginning to close, around 8pm.
Local media has reported on some occasions the number of migrants, mostly youths, outnumber police.
And reports claim some officers are intimidated by the migrants, and have been forced to introduce special measures to try and tackle the growing problem.
Shopkeepers and residents have reported threatening and intimidating behaviour from the outsiders.
And tensions have been running high for some time, with protests held last October on the Swedish island of Gotland after police released several accused rapists.
The migrants reportedly raped a wheelchair-bound woman in a small town called Visby, dragging her into an asylum centre where the ordeal allegedly took place.
A woman in her 30s reported the crime.
A record number of migrants sought asylum in Sweden – 163,000 in 2015 – reflecting the liberal asylum laws which are among the most relaxed in Europe.
But last year the Swedish parliament approved new laws that state if a person’s asylum application is refused or if they are issued with an explosion order they are no longer entitled to accommodation and daily allowances from the Swedish Migration Agency.