It's my understanding that the Law was not intended to bring righteousness but rather judgement, for being under the law only brought the curse of condemnation, thus the righteousness of Christ can come only by faith (Gal 3:10; Rom 4:13).
Being under the law only brought the curse of condemnation?
The law was added to the Abrahamic Covenant, until the Seed should come, because of the transgression of the children of Israel.
This enabled the children of Israel to have animals, take their place of punishment, so that the penalty for sin, which was death, was paid for by the innocent animal, on behalf of the one who sinned.
The children of Israel had been in Egypt for 400 years, and had grown accustomed to the gods and the ways of the Egyptians, in which they had strayed from the way of Abraham, who walked by faith, and obeyed God's Voice.
Since the children of Israel had transgressed the covenant, they needed a way to learn to righteous ways of the Lord, and to have the blessing of the Lord upon them... [I will be an enemy to your enemies, and curse them who curse you].
On the other hand, the Lord needed them to take the promised land away from the giants, which God promised to give to Abraham and his descendants, but couldn't do without His blessing upon them, the blessing of Abraham.
The law of Moses acted as a fence around the Abrahamic Covenant, to keep them from transgressing the Covenant, so God could continue to bless them, and fight for them to take the promised land which He promised to Abraham, Isaac and Jacob.
The law was added until the Seed should come.
JLB