The Syrian exodus, the Central American caravan and the Mediterranean peppered with dinghies – just some of the migrant crises which have dominated headlines around the world in recent years.

Globally, more than five times the population of Ireland are refugees and three million people are asylum seekers around the world.

People wait to be rescued in the Mediterranean

The Migrant Caravan making its way through Mexico earlier this year

An unprecedented 68.5 million people around the world have been forced from home.

Fleeing inequality, violence and conflict, over half of those displaced are from the same three countries: South Sudan, Afghanistan and Syria.

Syrian children in Douma after an attack (Courtesy: Syrian Civil Defence)

There are about 258 million migrants worldwide, or 3.4% of the global population, according to the United Nations.

Where they go has become become a divisive political issue as governments bicker over the migrants' futures.

But there have been UN efforts to broker a deal aiming at improving the way the world copes with rising migration.

The UN Migration Pact was the first major attempt to coordinate a global approach to tackle the situation.

But it has been a long, diving and troublesome road to get there.

How did the UN Migration Pact come about?

By boat and foot, more than a million people arrived in Europe in 2015.

It plunged the EU into a massive political crisis over migration.

The LÉ Eithne rescues migrants from the Mediterranean

Countries argued over how what to do with the mass influx of people.

Some wanted to close borders, others did and a few agreed to accept a percentage of them into their countries.

In 2015, Hungary built a border with Serbia and Croatia to prevent people from entering

With a clear lack of direction available to governments on what to do, the United Nations convened a meeting to address how member nations could respond.

A year later, the decision to negotiate the first international framework for migration was taken at the UN General Assembly in September 2016.

It called for the adoption of a migration pact by the end of 2018.

After tough negotiations, UN members during the summer finalised the so-called Global Compact for Safe, Orderly and Regular Migration to better handle migration.

What is the UN Migration Pact?

A better approach to facilitating safe and orderly migration is the main focus of the agreement.

It looks at protections for migrants, guidance on integration and returning them to their home countries.

The pact also includes a pledge to fight all forms of discrimination, xenophobia and intolerance against all migrants.

The UN agreement sets out 23 objectives to open up legal migration and better manage the global flow of 250 million people.

It proposes a pledge to "support appropriate reception of refugees and asylum-seekers" and" strengthen capacity for reception".

This includes offering clear information on immigration law and application processes to the public and giving legal identity and documentation to all migrants.

It is estimated there are 10 million stateless people globally who have been denied a nationality and access to basic rights such as education, healthcare, employment and freedom of movement.

Let’s work together for a safer, less fearful and more prosperous future for both for our own societies and for the world’s migrants. -@antonioguterres to world leaders gathered to adopt the Global Compact #ForMigration. https://t.co/sQTiZ5pLDb pic.twitter.com/v4Gmy34W8K — United Nations (@UN) December 10, 2018

Governments supporting the pact have agreed to open up more avenues for legal migration to encourage labour mobility, education opportunities and prevent migrants from falling victim to traffickers.

It also aims for governments to review recruitment of migrant workers to ensure processes are fair and ethical.

As the agreement aims to protect the human rights of migrants, it does not create a right to migration.

The United Nations has hailed it as a historic and comprehensive pact that could serve as a basis for future policies.

The UN has said the aim is to combat people trafficking and smuggling and reduce reliance on immigration detention centres.

Is it legally binding?

The simple answer is no, as it is not a treaty or a formal agreement.

It is a pact, which means it expresses the political commitment of states to achieve the 23 goals outlined in the text.

Who has signed up to the pact? Or more importantly, who hasn't?

A contentious issue like this comes with many problems.

A draft plan was agreed in July by all 193 UN members but many have dropped out since then.

Groups argue that the pact is an affront to national sovereignty and weakens the authority of governments over their borders and foreign policy.

Protesters in Latvia over immigration in 2015

In December 2017 the United States, home to one of the world's largest migrant populations, announced that it would not take part in negotiations.

Playing to US President Donald Trump’s "America first" base, the Trump administration has pulled out, saying involvement in the process interferes with American sovereignty, and runs counter to US immigration policies.

Police at San Ysidro by the US/Mexico border as the migrant caravan approaches

A number of countries have followed suit.

Since the final text was agreed in July this year, Hungary, Australia, Poland, Slovakia, the Czech Republic, Austria, Chile, Dominican Republic, Latvia and Italy have quit the pact or expressed serious reservations.

Austria, for example, said in October it will back out because the pact will blur the line between legal and illegal migration, echoing comments from Hungary and Poland.

Thousands in Rome protest against 'unfair' anti-migrant policies by Interior Minister Matteo Salvini

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

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

Charles Michel secured a large parliamentary majority in favour of supporting the UN text

The right-wing nationalist party had power over migration policy and aimed to hurry up deportations from Belgium and stated that taking part in the pact meant giving up sovereignty over the country’s borders.

Prime Minister Michel has been scrambling to hold power due to the political upheaval but he vowed to sign the pact.

A number of countries, including Bolivia and Israel, remain undecided about whether to adopt the recommendations.

Where is Ireland in all of this?

Minister for Justice and Equality Charlie Flanagan is representing Ireland at the UN inter-governmental conference in Marrakesh.

Leaders voted to implement the UN global pact in Marrakesh

In a statement, Mr Flanagan said that migration "is a global issue that requires global solutions" and that the pact is a "strong framework" for cooperation in these challenges.

He said that Ireland can play the part "in helping ensure that migration can be safer, more orderly and better managed."

What's next?

Despite all of the opposition, 164 nations today agreed the global pact to better manage migration.

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.

Angela Merkel told the conference that it is a pact is 'worth fighting for'

At the intergovernmental conference in Marrakesh, the German Chancellor praised the non-binding agreement and said the migration is a "natural phenomenon".

UN Secretary General António Guterres hailed the pact as "inspiring".

He said: "In the many places where fertility is declining and life expectancy is rising, economies will stagnate and people will suffer without migration."

Mr Guterres may describe it as a "roadmap to prevent suffering and chaos", but whether it will make migration safer and better managed is a waiting game.

For those who are not on board, they will be watching and waiting for the outcomes.