As God in the person of Jesus Christ gave His all by laying down His life to save sinners from sin, the sinner gives his all out of loving obedience not to sin against the one who saves him from it.
This is how grace necessitates the law. The law is kept because of God’s love through His grace. Through His grace in the self sacrificial act of His Son as our substitute for sin. After being excused from its penalty, which is death due to transgression; the transgressor no longer chooses to live in sin to keep the law.
The redeemed then freely obey God out of love by keeping His commandments. As a consequence of faith in His love of the sacrifice of His son. And would rather die to transgress God’s law than to wilfully crucify afresh their redeemer again. Hebrews 6:6-8
To not keep the law is to live in transgression. And whatever is without faith is a sin, which is transgression of the law. For sin is the transgression of the law, and the opposite of having faith. 1 John 3:4 and Romans 14:23.
Thus, faith establishes the law. Wherefore, the law is kept by having faith in God’s love through His grace in loving obedience. Romans 3:31