This is why “it was credited to him as righteousness.”
And therefore it was imputed to him for righteousness.