Despite a boycott from the United States, UN member states on Friday backed a global pact on migration, pledging to boost cooperation in addressing the world's growing flows of migrants.
Applause broke out at a UN conference room when the final text was approved following 18 months of negotiations on what is billed as the first international document on managing migration.
The buoyant mood shifted however when Hungarian Foreign Minister Peter Szijjarto took the floor to say his country is likely to pull out of the non-binding agreement.
The foreign minister expressed concern that the agreement could lead to stronger measures that would force governments to open up their borders to migrants -- a move Hungary sees as a threat to stability.
"We don't think that anyone has a right to pick a country where he or she would like to arrive as a country of destination and in order to do so to violate a series of borders," said Szijjarto.
The Hungarian government will decide on Wednesday whether to withdraw from the global compact for migration, he added.
If Hungary quits the deal, it will follow Washington, which announced in December that it was withdrawing from negotiations on the pact because of provisions "inconsistent with US immigration and refugee policies."
On a visit to Britain, President Donald Trump criticized European immigration policies, saying allowing "millions and millions of people to come into Europe is very, very sad."
"I think you're losing your culture," he said in an interview to a British tabloid.
The global pact lays out 23 objectives to open up legal migration and better manage the influx as the number of people on the move worldwide has increased to 250 million, or 3 percent of the world's population.
Negotiations faced hurdles over how to address illegal migration, with some governments insisting that migrants who fail to be properly registered be returned to their countries of origin.
UN special envoy for international migration Louise Arbour described the document as "the beginning of a conversation" to face up to what she termed as the new "human mobility" in the world.
"We are going to have to revisit some of these issues, possibly with more robust mechanisms," Arbour said, but the document is a "launching pad to do much, much better."
UN Secretary-General Antonio Guterres has argued that governments should recognize that "migration is a positive global phenomenon" and that migrants are needed to keep labor markets afloat.
At a news conference on Thursday, he cited his personal experience of hiring migrant workers to care for his elderly mother in Portugal. "I've never seen a Portuguese taking care of my mother," said Guterres.
The document will be formally adopted during a conference in Morocco on December 10-11.
Hungarian Foreign Minister Peter Szijjarto (pictured here at a June 2018 meeting in Germany) signaled Hungary's opposition to a new UN global accord on migration, following the US position on the deal