Managing migration is one of the most profound challenges for international cooperation in our time. Migration powers economic growth, reduces inequalities and connects diverse societies. Yet it is also a source of political tension and human tragedies. The majority of migrants live and work legally. But a desperate minority are putting their lives at risk to enter countries where they face suspicion and abuse.

Demographic pressures and the impact of climate change on vulnerable societies are likely to drive further migration in the years ahead. As a global community, we face a choice. Do we want migration to be a source of prosperity and international solidarity, or a byword for inhumanity and social friction?

This year, governments will negotiate a global compact on migration through the United Nations. This will be the first overarching international agreement of its kind. It will not be a formal treaty. Nor will it place any binding obligations on states. Instead, it is an unprecedented opportunity for leaders to counter the pernicious myths surrounding migrants, and lay out a common vision of how to make migration work for all our nations.

This is an urgent task. We have seen what happens when large-scale migration takes place without effective mechanisms to manage it. The world was shocked by recent video of migrants being sold as slaves.

Grim as these images were, the real scandal is that thousands of migrants suffer the same fate each year, unrecorded. Many more are trapped in demeaning, precarious jobs that border on slavery anyway. There are nearly six million migrants trapped in forced labour today, often in developed economies.

How can we end these injustices and prevent them recurring in future? In setting a clear political direction about the future of migration, I believe that three fundamental considerations should guide discussions of the compact.

The first is to recognise and reinforce the benefits of migration, so often lost in public debate. Migrants make huge contributions to both their host countries and countries of origin.

Migrants make huge contributions to both their host countries and countries of origin

They take jobs that local workforces cannot fill, boosting economic activity. Many are innovators and entrepreneurs. Nearly half of all migrants are women, looking for better lives and work opportunities.

Migrants also make a major contribution to international development by sending remittances to their home countries. Remittances added up to nearly $600bn ($445bn) last year, three times all development aid. The fundamental challenge is to maximise the benefits of this orderly, productive form of migration while stamping out the abuses and prejudice that make life hell for a minority of migrants.

Second, states need to strengthen the rule of law underpinning how they manage and protect migrants – for the benefit of their economies, their societies and the migrants themselves. Authorities that erect major obstacles to migration – or place severe restrictions on migrants’ work opportunities – inflict needless economic self-harm, as they impose barriers to having their labour needs met in an orderly, legal fashion.

Worse still, they unintentionally encourage illegal migration. Aspiring migrants, denied legal pathways to travel, inevitably fall back on irregular methods. This not only puts them in vulnerable positions, but also undermines governments’ authority. The best way to end the stigma of illegality and abuse around migrants is, in fact, for governments to put in place more legal pathways for migration, removing the incentives for individuals to break the rules, while better meeting the needs of their labour markets for foreign labour.

States also need to work together more closely to share the benefits of migration, for example through partnering to identify significant skills gaps in one country that migrants from another are qualified to fill.

Third and finally, we need greater international cooperation to protect vulnerable migrants, as well as refugees, and we must reestablish the integrity of the refugee protection regime in line with international law. The fate of the thousands who die in doomed efforts to cross seas and deserts is not just a human tragedy. It also represents the most acute policy failure: unregulated, mass movements in desperate circumstances fuel a sense that borders are under threat and governments not in control. In turn this leads to draconian border controls that undermine our collective values and help perpetuate the tragedies we have too often seen unfold in recent years.

We must fulfil our basic obligations to safeguard the lives and human rights of those migrants that the existing system has failed. We must take urgent action to assist those now trapped in transit camps, or at risk of slavery, or facing situations of acute violence, whether in North Africa or Central America. We have to envisage ambitious international action to resettle those with nowhere to go.

We should also take steps – through development aid, climate mitigation efforts and conflict prevention – to avoid such unregulated large movements of people in future. Migration should not mean suffering.

We must aim for a world in which we can celebrate migration’s contributions to prosperity, development and international unity. It is in our collective power to achieve this goal. This year’s global compact can be a milestone on the road to making migration truly work for all.

• António Guterres is secretary general of the United Nations