For some fifty years, the US has had a policy of welcoming refugees fleeing the brutal communist dictatorship in Cuba. In the 1990s, the policy was changed to “wetfoot, dryfoot,”under which Cubans who succeeded in reaching the United States would be allowed to stay, but those unfortunate enough to be caught at sea were barred. On Thursday, President Obama ended the wetfoot, dryfoot policy and made Cuban refugees “subject to removal,” like undocumented migrants from other countries. They might still gain official refugee or asylum status and be allowed to stay by proving that they have been personally targeted by the government on the basis of their political speech, religion or some other characteristics. But that is extremely difficult in most cases. For most Cubans, like other victims of communist governments, the main injustice they suffer is the everyday oppression meted out to all the regime’s subjects.

There is absolutely no justification for Obama’s new policy. It is gratuitously cruel towards Cuban refugees, without creating any meaningful benefits. Despite some modest economic reforms, Cuba remains a repressive communist dictatorship whose people suffer massive oppression and poverty brought on by over fifty years of totalitarianism. Indeed, repression of dissent has actually increased since President Obama began to normalize relations with Cuba in December 2014.

If anything, the United States would have done better to end the “wetfoot” portion of the policy and stop turning back Cuban refugees who have the misfortune to be caught at sea. Where a refugee happens to be found by US authorities is a morally arbitrary characteristic that in no way changes their status as victims of brutal tyranny.

The main victims of Obama’s new policy will be Cubans denied the chance to seek freedom and opportunity. But native-born Americans will lose out as well. The hundreds of thousands of Cuban refugees who came to the US fleeing communism have made major contributions to our economy and society. As President Obama himself said just a few months ago: “In the United States, we have a clear monument to what the Cuban people can build: it’s called Miami.”

President Obama and the US government are not responsible for the oppression that Cuban refugees are fleeing. But they are responsible for using force to compel refugees to return to a nation where further oppression is likely to be their lot. Such action makes the US government partially complicit in the injustice perpetrated by the Cuban regime.

The main rationale for the policy change is that it is unfair to treat Cuban refugees differently from those fleeing other oppressive governments. As President Obama put it, we should treat them “the same way we treat migrants from other countries.” Ideally, we should welcome all who flee oppression, regardless of whether their oppressors are regimes of the left or the right, or radical Islamists.

But the right way to remedy this inequality is not to treat Cuban refugees worse, but to treat other refugees better. And if the latter is not politically feasible, we should at least refrain from exacerbating the evil by facilitating the oppression of Cubans. It is better to protect Cuban refugees from the risk of deportation than none at all.

If a police force disproportionately abuses blacks, it would be unjust to “fix” the inequality by inflicting similar abuse on whites or Asians. Inflicting abuse on other groups is both unjust in itself and unlikely to help blacks. Similarly, the injustice inflicted on refugees from other oppressive regimes cannot and should not by imposing similar injustices on Cubans.

In his recent Farewell Address, President Obama rightly celebrated our history of welcoming “immigrants and refugees across oceans and the Rio Grande” and emphasized that “America wasn’t weakened by the presence of these newcomers; these newcomers embraced this nation’s creed, and this nation was strengthened.” Sadly, just two days later he himself violated the very principles he himself espoused.

The president deserves credit for his previous efforts to protect undocumented migrants. But his legacy is tarnished by the gratuitous cruelty of what may well be his last major policy initiative.

This piece was originally published at the Volokh Conspiracy at the Washington Post website.