1813. 'He reckoned it to him as righteousness' means that in this the Lord first became righteousness. This too becomes clear from the train of thought in the internal sense, in which the Lord is the subject. That the Lord alone became righteousness for the sake of the whole human race becomes clear from the consideration that He alone has fought out of Divine Love, that is to say, out of love towards the whole human race, whose salvation, that and nothing else, He desired and longed for in His conflicts. The Lord was not born righteousness as regards the Human Essence but became righteousness through the conflicts brought about by temptations and through victories, something He achieved by His own power. And as often as He fought and won the victory, this was reckoned to Him as righteousness, that is, it was added to the righteousness He was becoming, as an increase to it every time, until He became perfect righteousness.
 When one who is begotten from a human father, that is, from the seed of a human father, fights for himself, he cannot possibly do so out of any other love than love of self and love of the world, thus not out of heavenly love but out of hellish, for such is the nature of the proprium he possesses from his father in addition to the proprium he has acquired by his own actions. Consequently the person who imagines that he fights the devil from himself is grossly mistaken. So too the person who wishes to make himself righteous by his own powers, that is, to believe that the goods of charity and the truths of faith come from himself, and consequently to merit heaven through them, is acting and thinking contrary to the good and truth of faith. For it is a truth of faith, that is, it is the truth itself, that the Lord is the one who does battle. Thus because he is acting and thinking contrary to a truth of faith, he deprives the Lord of what is His and makes what is the Lord's his own; or what amounts to the same, he replaces the Lord with himself and so with that in himself which is from hell. It is for this reason that people wish to become great or the greatest in heaven, and thus it is that they believe quite wrongly that the Lord fought against the hells so that He might be the greatest. The human proprium has delusions such as these within it which have all the appearance of being truths but which are quite the reverse.
 That the Lord came into the world so as to become righteousness, and that He alone is righteousness, was also foretold by the Prophets. Thus it was possible to know of this even before His Coming, and also to know that He could not become righteousness except by means of temptations and victories over all evils and over all the hells, as in Jeremiah,
In His days Judah will be saved, and Israel will dwell with confidence. And this is His name which they will call Him. Jehovah our Righteousness. Jeremiah 23:6.
In the same prophet,
In those days and at that time I will cause a shoot of righteousness to sprout forth for David, and he will execute judgement and righteousness in the land. In those days Judah will be saved and Jerusalem will dwell with confidence. And this is what they will call Him, Jehovah our Righteousness. Jeremiah 33:15-16.
He saw and there was no man, and wondered that there was no intercessor, and His own arm brought salvation to Him, and His righteousness upheld Him. And He put on righteousness as a breastplate, and a helmet of salvation upon His head. Isaiah 59:16-17.
And see especially Isaiah 63:3, 5. 'His own arm' stands for His own power. Since the Lord alone is righteousness, the expression a habitation of righteousness is also used, in Jeremiah 31:23; 50:7.
(References: Genesis 15:6)