A High Court judge found that the checks, imposed to discourage illegal migration, led to discrimination.