Justice is the unchanging law that brings consequences for actions. Because of the law of justice, you receive blessings when you obey God’s commandments (see D&C 130:21–22). The law of justice also demands that a penalty be paid for every sin you commit. It requires that no unclean thing be permitted to dwell with God (see 1 Nephi 10:21).
When the Savior carried out the Atonement, He took our sins upon Himself. He was able to “answer the ends of the law” (2 Nephi 2:7) because He subjected Himself to the penalty that the law required for our sins. In doing so, He “satisfied the demands of justice” and extended mercy to everyone who repents and follows Him (see Mosiah 15:9; Alma 34:14–16). Because He has paid the price for your sins, you will not have to suffer that punishment if you repent (see D&C 19:15–20).