Hungarian Prime Minister Viktor Orban is a fierce critic of European migration policy. Budapest has repeatedly stressed the necessity to strengthen the protection of the EU’s external borders and to create migration transit centers outside the bloc.

Hungary's Foreign Minister Peter Szijjarto announced that Budapest would withdraw from the United Nations Migration Pact before it is formally approved.

"This document is entirely against Hungary's security interests," he said, adding that the accord posed a "threat to the world."

The UN migration agreement, officially called the Global Compact for Safe, Orderly and Regular Migration, was negotiated in the wake of 2015 refugee crisis in Europe when over a million migrants came to Europe fleeing from wars and disasters in their home countries in North Africa and the Middle East.

READ MORE: Hungary Doesn't Feel Responsibility For Migrants Under Dublin System — Merkel

According to UN Secretary-General Antonio Guterres, the goal of the accord is to guarantee the basic human rights of all refugees.

Although Europe struggles to find a unified solution for the crisis, there are many divisions over the way it should be done. Hungary is not the first country to pull out of the UN pact. Washington decided to boycott the agreement in December 2017, as US President Donald trump took a hostile stance towards refugees.

The agreement is due to be finally approved in December during a meeting in Marrakesh, Morocco.