When God “credits righteousness", He is conferring a legal status on someone. He treats them as actually righteous and free from condemnation, even though they are still actually unrighteous in their heart and behavior. They are “justified.”
Galatians For You, The Good Book Company, 2013.