Geneva - The United Nations warned Kenyan authorities on Tuesday that closing the world's biggest refugee camp complex would have "extreme humanitarian and practical consequences" and would violate international law.

On Sunday, the Kenyan government said it had asked the UN refugee agency to repatriate hundreds of thousands of Somali refugees from the sprawling Dadaab refugee camp by July in the wake of the Garissa University massacre claimed by al-Shabaab insurgents from Somalia.

"We recognise the obligation of the government to ensure the security of its citizens and other people living in Kenya, including refugees," UNHCR spokesperson Karin de Gruijl told reporters in Geneva, expressing shock at the April 2 attack that left nearly 150 people dead.

However, she said the UNHCR was deeply concerned that abruptly closing Dadaab, which houses 350 000 refugees and is considered the world's biggest camp, and forcing refugees to return to Somalia could have dire consequences.

Such a move "would have extreme humanitarian and practical consequences, and would be a breach of Kenya's international obligations," de Gruijl said.

"We are thus urging the Kenyan authorities to give the matter further consideration," she said.

Kenya hosts some 450 000 Somali refugees, most of them housed in Dadaab's vast complex of five camps.

The site opened in 1991 after the collapse of Somalia's hardline Siad Barre regime when the country plunged into chaos.

The Kenyan government had already sought the closure of Dadaab after the September 2013 Shabaab attack on the Westgate shopping mall in Nairobi that left at least 67 people dead, saying the camp was a breeding ground for Islamist militants.

In November that year, Kenya, Somalia and the UNHCR signed a joint deal to back the voluntary repatriation of Somalis.