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.
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.