“The origin of the covenant of grace was the unparalleled, incomprehensible love of God to sinners of the human race. The obstacles in the way of accomplishing the salvation of those, whose death was demanded by law and justice, were apparently insuperable. It may be presumed, that if the problem, how God could be just and yet justify the ungodly, had been proposed to a conclave of the brightest angels in heaven, they could not have worked out a satisfactory answer: it would have baffled their utmost intellectual efforts. That God cannot cease to treat his creatures according to the principles of eternal justice is most evident; and that justice required that the sinner should suffer, according to his demerit, is equally evident. Where, then, is there any foundation for hope in regard to those who have once transgressed? And not only the justice, but the truth of God stood in the way of the sinner’s salvation. God had threatened the penalty of death, interminable death; and the Ruler of the universe must maintain the truth of his word, as it respects his threatenings as well as his promises… But that which could not be discovered by the wisdom of creatures, was devised by the infinite wisdom of God. In the counsels of the adorable Trinity the plan was agreed upon. Between the Father and the Son, a transaction took place, which may strictly be termed a covenant, for, speaking after the manner of men, there were mutual stipulations entered into between the high contracting parties.” (Archibald Alexander)
For more on this subject, please visit the Biblical Theology page.