What happens when someone is given a court order that is against the law?
If you do not follow the order, the judge will hold you in contempt of court, or give you a steep fine, or even issue a harsh prison sentence.
If you do follow the order, do you risk prosecution and sentencing in another court?
Just one example:
Judge orders NYFD to hire minorities who failed test.
Or more commonly, in the USA, individual states will try to enforce laws that conflict with federal regulations. In some situations, there might simply be no way to comply with both conflicting sets of laws without going out of business.