A new UN pact on global migration is proving highly controversial across Europe.

Supporters of the agreement say it will foster co-operation and improve the handling of millions of migrants but critics fear it will encourage more illegal migration.

Protests held against the agreement in Brussels turned violent and it's led to the Belgian Prime Minister, Charles Michel, offering his resignation.

Reality Check has looked at the details of the agreement and why it's faced so much opposition.

What is the UN's migration pact?
Negotiations leading to the Global Compact for Safe, Orderly and Regular Migration began in 2016, following the arrival of over one million people into Europe.

It's not legally binding and allows countries to remain in charge of their own immigration policy but commits signatories to improving co-operation on international migration.

The pact was agreed by all 193 members, except the United States, in July.

But at the ceremony to adopt the text on 10 December, only 164 countries formally signed it.

Among those who refused to adopt the deal - in addition to the United States - were Hungary, Austria, Italy, Poland, Slovakia, Chile and Australia.

The report sets out 23 objectives for safe, orderly and regular migration.

Some of the objectives and policy recommendations aim to:

gather better data on international migration
minimise factors that compel people to leave their own country
provide migrants with a proof of legal identity
reduce vulnerabilities in migration, including "the conditions they face in countries of origin, transit and destination"
combat smuggling and people trafficking

The agreement emphasises that all migrants are entitled to universal human rights and aspires to eliminate all forms of discrimination, including racism, xenophobia and intolerance against migrants and their families.

The compact "reaffirms the sovereign right of states to determine their national migration policy". The European Commission says it will have no legal effect on national legal systems.

Speaking at the signing ceremony in Marrakech, Morocco, the German Chancellor, Angela Merkel, noted that illegal migration had triggered significant fears in some countries but these fears had been "used by the opponents of the pact to spread false information".

At the same event, the UN Secretary General, Antonio Guterres, said "myths" surrounded the agreement.

What does it mean for immigration in the UK?
The UK endorsed the deal and praised it as a way to tackle illegal migration as well as keeping migrants around the world safe.

The government has been clear that the UN agreement will not change the ability of the UK to set its own migration policy.

The compact "protects every state's right to determine its own immigration policies, including in areas such as asylum, border controls and returns of illegal migrants", said Lord Bates, Minister of State at the Department for International Development.

However the non-binding deal has created political tensions in several countries, with politicians claiming it will lead to more migration or erode a country's ability to be in charge of immigration laws.

In the UK, an online petition signed by more than 100,000 people asked the UK not to agree to it.

What do opponents dislike about the pact?
The UN document is a statement of intent and aimed at framing migration as an economic issue, says Susi Dennison, a senior policy fellow at the European Council on Foreign Relations.

It was designed "to de-politicise migration again but the pact has done the opposite", she says.

The US, in December 2017, was the first country to pull out.

A statement at the time said the agreement was incompatible with US sovereignty and "our decisions on immigration policies must always be made by Americans and Americans alone".

Hungary followed in July 2018 - and, at the time, the foreign minister said: "This pact poses a threat to the world from the aspect that it could inspire millions [of migrants]."

Criticism in Europe rose as the date for the signing of the agreement approached.

Former Donald Trump adviser Steve Bannon and far-right leader Marine Le Pen attended an event together in Belgium to oppose the pact.

"The country that signs the pact, obviously signs a pact with the devil," said Ms Le Pen.

Polish Interior Minister Joachim Brudziński has said the pact "could also be an incentive for illegal migration".

Germany backed the agreement but faced stern opposition. Alice Weidel, leader in the German parliament of the far-right party Alternative for Germany (AfD), said: "In effect, illegal migration is being legalised."

A key reason why this pact has been the focus of so much debate is because immigration is a huge topic in Europe, says Ms Dennison. And it will continue to be in the run up to European Parliament elections in 2019.

"Opposition to the pact underlines that migration is the number one political issue in Europe. It really is the dividing issue for electorates."