As an extreme example, consider murder. Obviously it should be illegal, but if it's legal for one group and not for another, the group for which it's illegal will probably be wiped out, having lost the ability to avenge deaths in the group.
It's much more important that laws are applied impartially and equally than that they are even a tiny bit reasonable.