Even though Torah involves laws that are for the public domain , it is mainly oriented towards personal morality. [And it is well known in Moral Philosophy that there is a very large difference between personal morality and public. I can not think of an example this minute since my thoughts are going in a different direction. (note 1)] So while public law is very important, still it is very different from Torah. (note 3) A good example in Henry II. His job after becoming king was to bring stability and peace to England after decades of chaos and anarchy. So he unified the laws. No more was each county going to have a different set. There was to be one set for all England. And circuit judges just as is done today in the USA. And trial by jury, not by physical combat.[כל דאלים גבר]. But on the other side of things, Torah is personal. even though many of the laws are in the public domain , but the center of gravity is the relationship between the individual and God.
So in Torah it matters not what goes on in the public domain. I might be living in a city that is an עיר הנדחית [a city that has gone astray after idolatry]. That does not absolve me of responsivity to Torah. Just think about Eliyahu the prophet and Elisha his disciple that lived in the Shomron area. [The center of Israel, not the Jerusalem area.] Though the state was officially serving idols, they certainly refused.
[The Northern kingdom of the ten tribes was officially serving the idols that had been set up by Yeravam ben Navat. So you can have Jewish idols. The fact that everyone is serving them does not make it okay. So I suggest that the signature of the Gra on the letter of excommunication is still valid, even if everyone refuses to pay any attention. (note 2) And this is easy to see as you can find a simple and understandable definition of idolatry in the commentary of the Rambam on Sanhedrin perek Helek. Worship of anything in heaven and earth except for God is idolatry. Not just physical statues.]
note 1. Here is a text from the Ethics textbook of Stephen O Sullivan and Philip A. Pecorino 2002. [published by CUNY] Here are some examples of actions that are illegal but are thought to be moral (for many)!
Drinking under age.
Driving over the speed limit on a desert highway with no cars or people anywhere around.
Smoking marijuana.
=================================================
People do not think of themselves or of others as being immoral for breaking these laws.
=================================================
Here are some examples of actions that are immoral (for many) but are not illegal.
Breaking a promise to a friend.
People can not be arrested or punished with imprisonment or fines for doing these things.
(note 2) The validity of a "herem" [excommunication] is from the laws of nedarim [vows]. [This I noticed in a commentary on the Rambam on the bottom of the page.] What is a vow? It is when one says, "This loaf of bread is forbidden to you like a sacrifice." If he owns that loaf, then that loaf becomes forbidden to the person he is talking to. Similarly a herem is valid, as long as the person making it is qualified.] Why does he say like a sacrifice. It is commonly accepted that this is a argument between the Rambam and Tosphot. However Rav Shach points out that just saying "this loaf is forbidden to me" instead of being a way of making avow by its simple meaning would simply be an untruth!
\
(note 3) Peace of the state is one reason for many commandments, but that is not the central source of authority of Torah