You *can* selectively apply it [law], so long as there is ethical basis for what you do.
History has shown that we can't rely on ethics instead of law. Ethics differ widely between cultures and individuals, and are highly subjective.
Many experiments and real life events have proven peoples' ethics to be highly flexible/optional and quickly surrendered in difficult situations.
The law and in particular criminal law, human rights law and (to a lesser extent) employment law generally reflect minimum standards of ethical behaviour. They exclude particularly many particularly unacceptable behaviours and do so in a largely objective way. They change over time to reflect societies views.
This is an intelligent comment and to an extent I agree. But I also believe in civil disobedience. Legislators often enact laws that are poorly thought out, have unintended consequences, or are simply evil. There are many, many examples of this, large and small. Unjust laws can be and should be challenged. That is the ethical response.