It was to show his righteousness at the present time, so that he might be just and the justifier of the one who has faith in Jesus.Romans 3:26(ESV)
God cannot and will not go against the laws and principles that He set by His mighty will and eternal wisdom - God will never violate His own nature. God is loving and merciful - He is abounding in tender-kindness and desires to forgive sinners... but God is also holy and righteous. He is just and unchanging, and God must uphold His holy laws and His just decrees, which He Himself established in the beginning. A holy and righteous God MUST punish sin.
And so God in His wisdom and love constructed the glorious plan of Salvation to demonstrate His righteousness and grace - His love and His justice. God sent His only begotten Son, the Lord Jesus Christ to REDEEM mankind - to bring men out from slavery to sin and death into the light of the glorious gospel of peace-with-God.
He presented Christ as the PROPITIATION for our sins by pouring out the wrath that was our portion onto His perfect Son, Whose sacrifice on the cross, satisfied God's righteous anger on behalf of all who would believe in Him, for His wrath was poured out on Jesus Christ in our stead.
In an act of grace and love God JUSTIFIED the sinner, declaring him to be righteous - covering all who believe in Christ with the pure righteousness HIM, who bore the punishment that we so justly deserved.
Never let us forget that our Salvation brought us out of Adam and into Christ... His death on the cruel cross gave us His abundant and eternal life - His punishment was in payment for our sins - His resurrection broke the power of sin and death to all who believe on Him.
He took our sins upon Himself, so we could be clothed in His perfect righteousness, and God's wrath was poured in all its fury on Him so that God's perfect peace could be our portion - in all its abundance.
Thank You Father - thank You for my salvation. Thank You that His death that gave me life and reconciled me to You forever. Thank You that He took my sin and clothed me in His righteousness. Thank You that He is the propitiation for my sins and took Your wrath upon Himself so that I might have peace with You and receive the peace that passes understanding for ever and ever into my life, in Jesus name I pray, AMEN.