Justice and Mercy

Ezra reads the Book of Law to the gathered assembly for six hours, and they weep and are told to be joyful. How can we rejoice in the Law, and what is its relationship to Mercy?