The Law was designed to reveal man's inability to be as righteous as God and to reveal the need for a Savior through whom the righteousness of God would be given. The scribes and Pharisees attempted to keep the Law to make themselves righteous before God and thought they did not need a Savior and so rejected their Messiah.
Today many people try to keep the Mosaic Law or part of it, to make themselves righteous before God. But
Isa 64:6 But we are all as an unclean thing, and all our righteousnesses are as filthy rags; and we all do fade as a leaf; and our iniquities, like the wind, have taken us away.
The 'good' we do is called relative righteousness and can never measure up to the standards of an absolutely holy God.
Christ died and paid for our sins on the Cross. He didn't die for our inadequate righteousnesses. There is no way man can compete with God. So in order to make man righteous, God counts our faith as righteousness and imputes to us his own, when we place our faith in Christ and his work. God sees us through Christ and he was perfectly righteous and kept all of God's laws.
Rom 5
18So then as through one transgression there resulted condemnation to all men, even so through one act of righteousness there resulted justification of life to all men. 19For as through the one man's disobedience the many were made sinners, even so through the obedience of the One the many will be made righteous.
20(The Law came in so that the transgression would increase; but where sin increased,grace abounded all the more,
21so that, assin reigned in death, even so grace would reign through righteousness to eternal life through Jesus Christ our Lord.
Before Paul was saved he was a pharisee of the Pharisees, he said he kept the law blamelessly but he recognized his attempts at being righteous enough to live eternally before Holy God was rubbish.
Phil 3
8More than that, I count all things to be loss in view of the surpassing value of knowing Christ Jesus my Lord, for whom I have suffered the loss of all things, and count them but rubbish so that I may gain Christ,
9and may be found in Him, not having a righteousness of my own derived from the Law, but that which is through faith in Christ,the righteousness which comes from God on the basis of faith,
10that I may know Him and the power of His resurrection and the fellowship of His sufferings, being conformed to His death;