Gerry Simpson is Human Rights Watch's senior refugee researcher and advocate and author of the report "Pakistan Coercion, UN Complicity: The Mass Forced Return of Afghan Refugees." The views expressed in this commentary are his own.

(CNN) If you were one of the world's 21.3 million refugees and woke up one day to find the country that had sheltered your family for many years now considered you to be traitors and terrorists, what would you do? What if the government had given its police a green light to make your life miserable and were threatening to deport you in the middle of winter back to nothing — no home, no job, no school? Would you wait and see whether things calmed down or pack your bags and leave?

That's the terrible choice Pakistan gave its 2.5 million -strong Afghan community -- refugees and undocumented individuals -- last year, and it worked. A brutal police crackdown and deportation threats coerced over 600,000 Afghans in the last six months of 2016, including 365,000 registered refugees, to face danger and destitution back in Afghanistan.

Having hosted millions of Afghan refugees over several decades, Pakistan was well aware that it would have faced international condemnation had it forced the refugees into trucks and dumped them across the border.

In response to deteriorating political relations between Pakistan and Afghanistan, the authorities instead carried out a concerted campaign to make Afghans lives' so miserable they would leave. This included making their legal status insecure, threatening to deport them in the middle of winter and giving the police free reign to commit a range of abuses.

But coercing registered refugees into returning home against their will violates the international legal prohibition against refoulement -- not to forcibly return or pressure anyone into returning to a place where they would face a real risk of persecution, torture or other ill-treatment, or a threat to life.

Even worse, the United Nations High Commissioner for Refugees let itself be bullied into helping it all happen. By increasing cash payments to returning refugees and failing to publicly call for an end to coercive practices, the UN agency became complicit in Pakistan's mass refugee abuse.

The Afghan exodus from Pakistan in the second half of 2016 amounts to the world's largest unlawful forced return in recent years, making the UN's complicity all the more shocking. All eyes are now on Pakistan and the UN to see whether those wielding power over the remaining Afghans will reverse course.

And a recent Human Rights Watch report detailing the horrors experienced by Afghan refugees emphasizes why swift action on this issue is so crucial.

As a 25-year-old Afghan told me after his overnight return journey from Pakistan's border areas, "No matter who you are, your heart will turn black with so much abuse."

After an initial round of police abuses against the Afghan community in 2015, which triggered a first wave of Afghan refugee departures, the Pakistani authorities ditched their previous policy of renewing Afghan refugees' permits every few years. Instead, last year they gave the refugees six months to leave, at the very last minute gave them another six , and then said they had three more months to pack their bags.

Afghan refugees returning to Kabul told me the ever-present threat of imminent deportation, particularly in the middle of Afghanistan's bitterly cold winter, left them lying awake at night fearing for their families' lives.

Yet stripping Afghan refugees of a secure legal status wasn't the only ploy to coerce them out. The authorities also mounted an aggressive media campaign in newspapers and on television and radio, telling Afghans it was time to leave and that they risked summary deportation if they stayed.

This gave the Pakistani police a green light for a second round of anti-Afghan abuses in early July 2016. Returning refugees told Human Rights Watch that police raided their homes at night, accused them of being or harboring terrorists, threatened to split up families and deport them, arbitrarily detained them for hours or days at a time and regularly subjected them to crippling levels of extortion.

A day after the Human Rights Watch report was released, Pakistan issued a statement, saying that "notwithstanding any isolated or individual incidents, there is no policy of coercion" against Afghans. However, the government did not address any direct claims of police raids or forcible deportations.

And what did the UN refugee agency do to stop this mass exodus? It remained publicly silent about coerced returns and doubled its cash grant to $400 for every returning Afghan refugee.

For an average poor Afghan family of seven, $2,800 was an astronomical amount of money, about the same as a senior teacher's annual income in Afghanistan. For many who were on the fence about whether to wait, it proved to be the tipping point. Refugees told me they were afraid that if they didn't take the money, they would end up being deported penniless anyway.

UNHCR has told Human Rights Watch that, in its opinion, some Afghans returned from Pakistan "under difficult conditions" and that UNHCR's policies did not encourage anyone to leave against their will.

According to the United Nations, the vast majority of those returning are now homeless and without jobs. Many will join the estimated 1.5 million Afghans already displaced from their own homes by the country's spiraling conflict, which killed and maimed more Afghans in 2016 than any other year since records began in 2009. The Afghan government and aid agencies are overwhelmed and have been pleading with donors to fund emergency winter assistance.

But there may well be worse to come. Pakistan has made clear it wants to see the exodus continue this year, and in February, the authorities extended Afghan refugees' permits from March 31, 2017, only until the end of December . This means that the estimated 1.9 million Afghans remaining in Pakistan again face the prospect of deportation in sub-zero temperatures.

To add insult to injury, the UN refugee agency resumed its cash support, at a reduced rate of $200, on April 3. But absent a commitment by the Pakistani authorities to end all police abuses and stop its deportation threats, Afghan refugees will continue to leave Pakistan under pressure and involuntarily.

Follow CNN Opinion Join us on Twitter and Facebook

There is a real risk, then, of repeated mass unlawful forced refugee returns and a repeat of last year's failure by the UN refugee agency to do its fundamental duty to defend refugees against it.

To avoid triggering a humanitarian catastrophe in Afghanistan by forcing back hundreds of thousands more refugees, Pakistan should reverse course and protect Afghans until it is safe for them to go home. Afghanistan's donors should generously support Pakistan and aid agencies assisting Afghans in Pakistan and should press the government to end its abuses and threats. The government should extend refugees' registration cards until at least March 2019. And the UN refugee agency should stop supporting involuntary refugee return and unequivocally publicly challenge any further efforts by Pakistan to force out Afghan refugees.