A believer should abandon such sins, and follow the Book of Allah and the Sunnah of His Messenger (peace be upon him). This is an established fact. They should neither obey the ruler nor anyone else in what leads to the disobedience of Allah (Glorified and Exalted be He). The Prophet (peace be upon him) said,
Truly, obedience is only in what is good.
He (peace be upon him) also said,
There is no obedience to a creature in matters involving disobedience to the Creator.
May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.