They wanted to use the law in order to determine who is the best, who has earned life. Before they turned to God, they wanted to make sure that they were worthy of God. Consequently, they turned their attention to the law and away from the lawgiver. Observance of the law became a substitute for the relationship with the lawgiver. We call it legalism.
Legalism is an exaggerated concern with the law.
It assigns more power to the law than to the lawgiver. And indeed the law becomes a power, an oppressive power in our own hands. Legalism is really our own anxious efforts to limit and restrict the law. Our fear and anxiety before the power of the law are the result of having forgotten God who gave the law to serve life. We pick and choose the laws we want and try to forget the ones we do not like.