Hungary on Wednesday refused to sign a declaration recognising the advantages of migration, despite its adoption by more than 50 European and African countries at a Morocco conference.

Hungarian Foreign Minister Peter Szijarto slammed the declaration for portraying migration as "a phenomenon that is necessarily only good and favourable and which obviously contributes to the global development".

"We think this is a unbalanced approach and we disagree with it," he said.

Hungary's Prime Minister Viktor Orban was re-elected last month on a hardline anti-immigration platform which has seen him clash with Brussels and draw criticism from rights groups.

A Council of Europe report last week criticised the country for failing to do enough to identify potential victims of human trafficking in its "transit zones" for migrants and asylum seekers.

The Morocco declaration called for an "approach based on human rights" and the "protection of migrants in vulnerable situations" as well as efforts to tackle racism and discrimination.

It also covered illegal immigration and ways to help migrants return home, key talking points for European nations which have seen an influx of migrants in recent years.

It was signed by representatives from 27 European and 28 African countries at a conference on migration and development in the Moroccan city of Marrakesh.

European Union migration commissioner Dimitri Avramopoulos praised the declaration.

"Committed to strengthen our cooperation to address root causes, reduce irregular migration and enhance protection and legal channels," he tweeted.

"Europe and Africa need each other more than ever."

But Hungary's foreign minister said the focus should be "on how to stop illegal migration and not how to encourage it".

"We should not and must not deny that migration has very serious security aspects, it is unacceptable that such an aspect is totally left out from an international document," Szijarto said.

Belgian Foreign Minister Didier Reynders said Hungary's stance would "in no way diminish the determination of other European members" to find a common response to migration.

His Moroccan counterpart Nasser Bourita said migration is "too rich to be reduced to irregular immigration", appealing to European countries to "go beyond border control and the fight against migrant trafficking".

Morocco will host a United Nations migration summit in December, aimed at reaching a global accord.