Germany's justice minister has pledged to take steps to crack down on anti-foreigner crime after an unidentified assailant threw a hand grenade at an asylum seeker's home in the country's south west.

"It was just luck" that the device did not explode and nobody was harmed in the early morning attack against the home for asylum seekers in the town of Villingen-Schwenningen, regional police spokesman Thomas Kalmbach said.

Germany took in nearly 1.1 million asylum seekers last year and there have been multiple attacks on such residences, although most of them have been arson attacks against unoccupied buildings.

Justice minister Heiko Maass said the grenade attack represented a new level of "hate and violence" and that he is summoning his state counterparts to better co-ordinate local and federal measures to prevent and prosecute anti-immigrant hate crimes.

"Grenades are already flying towards refugee homes; we can't wait until there is someone dead," he said. "We need to do everything we can to ensure xenophobic crimes are more rapidly solved and punished more severely."

Police formed a special task force to look for the person or people behind throwing the grenade towards the home at 1.15am local time, Mr Kalmbach said.

Police said the grenade still contained its explosives but it is not clear whether it still had a detonator. Forensics experts are investigating.

Security personnel spotted the grenade and kept residents away while police responded.

A bomb squad destroyed the device in a controlled explosion on the scene at about 5am after evacuating the 20 residents from the home.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.