MARRAKESH, Morocco- The United Nations on Monday adopted a deal aimed at improving the way world copes with rising migration, but almost 30 countries stayed away from the ceremony in Morocco.

The pact, meant to foster cooperation on migration, was agreed in July by all 193 U.N. members except the United States, but only 164 formally signed it at the meeting on Monday.

Ten countries, mostly in formerly Communist Eastern Europe, have pulled out. Six more, among them Israel and Bulgaria, are debating whether to quit, a U.N. spokesman said after the pact was adopted. He did not say whether the rest of the countries absent from the conference in Marrakesh might also pull out.

With a record 21.3 million refugees globally, the United Nations began work on the non-binding pact after more than 1 million people arrived in Europe in 2015, many fleeing civil war in Syria and poverty in Africa.

But President Donald Trump's administration said the global approach to the issue was not compatible with U.S. sovereignty.

Since July, the accord, which addresses issues such as how to protect migrants, integrate them and send them home, has been criticised by mostly right-wing European politicians who say it could increase immigration from African and Arab countries.

Angela Merkel, accused by critics of worsening the refugee crisis by opening Germany's borders in 2015, said cooperation was the only answer to tackle the world's problems.

"The pact is worth fighting for," the German chancellor, one of around a dozen national leaders in Marrakesh, told the forum. "It's about time that we finally tackle migration together."

Without naming Trump or his "America First" stance, she said multilateralism was the way "to make the world a better place".

U.N. Secretary General Antonio Guterres said developed nations needed migration.

"In the many places where fertility is declining and life expectancy is rising, economies will stagnate and people will suffer without migration," he said in his opening address.

On Sunday, Chile withdraw from the pact, while Belgian Prime Minister Charles Michel saw the biggest party in his coalition quit in a dispute over the accord. 

In November, Austria's right-wing government, which holds the EU presidency, said it would withdraw, saying the pact would blur the line between legal and illegal migration.

Australia said it would not sign up to a deal it said would compromise its hardline immigration policy. 

(Reporting by Ulf Laessing Editing by Robin Pomeroy) ((Ulf.Laessing@thomsonreuters.com; Reuters Messaging: follow me on twitter @ulflaessing))