A person cannot violate a law they are not aware of, the Bible puts it this way –
Ro 4:15 for the law worketh wrath; but where there is no law, neither is there transgression.
Ro 5:13 for till law sin was in the world: and sin is not reckoned when there is not law; (YLT)
You can’t sin (violate the law) if you are not aware of the Law. Ignorance of the Law is a valid excuse before God.
Unbelievers do not understand justice.
Pr 28:5 ¶ Evil men understand not judgment, And those seeking Jehovah understand all. (YLT)
God’s people do understand and can tell the difference between right and wrong because they are so to speak “in the Law” of God, Rm 2:12.
Being “in” the Law of God means a person understands right from wrong, because God has made it apparent to them.
Ga 5:14 For the whole law is fulfilled in one word, even in this: Thou shalt love thy neighbor as thyself.
Being “under” the Law of God means that the Law of God is the authority over the person who has violated the Law of God and thus the person can expect to be judged accordingly.
Mt 5:26 Verily I say unto thee, thou shalt by no means come out thence, till thou have paid the last farthing.
Matt 5:26 means that a sinful person will be disciplined until they have made things right or made restitution.
Pr 2:9 Then understandest thou righteousness, And judgment, and uprightness–every good path. (YLT)
According to the human judicial system ignorance of the law is not an excuse. If a man says He was not aware that He was breaking the Civil laws the police will not accept His ignorance as an excuse.
God however does not feel that way. A person can choose to be “in” the Law or “apart” from it.
Ro 2:12 for as many as without law did sin, without law also shall perish, and as many as did sin in law, through law shall be judged, (YLT)
Those apart from the Law of God are referred to as unbelievers and those who have chosen to be a part of the Law of God are called believers.
From this it can be seen that being judged according to the law or being “in” the law of God is a blessing, not because a person will always be judged as being innocent but because the alternative is to be “apart from God’s Law and ultimately perish.
This is the truth regarding the age old question “Why do bad things happen to Good People”.