The ruling allows migrants to contest deportations to countries other than their place of origin.

The case could head to the Supreme Court.