For this reason it is by faith, in order that it may be in accordance with grace (NASB)
Is "the reason" the fact that "the Law brings about wrath" (4:15)? Or is it something else?
“For if those who are of the Law are heirs, faith is made void and the promise is nullified; for the Law brings about wrath, but where there is no law, there also is no violation.
The issue that Apostle Paul is pointing out is that if you are under the Law, then any promises made by faith are nullified.
You can choose to attain righteousness through the Law but if you take that option know that it comes with wrath if you fail.
If you however choose to accept righteousness through faith, since there is no law necessary to follow in order to attain said righteousness because you are just believing God for it and accepting it by faith, then there cannot be a violation of the law, you did nothing to earn it.
For this reason (it) righteousness is by faith, in order that (it) righteousness may be in accordance with grace, so that the promise will be guaranteed to all the descendants, not only to those who are of the Law, but also to those who are of the faith of Abraham, who is the father of us all,” Romans 4:14-16 NASB
So Apostle Paul is simply saying that if you accept by faith righteousness, then you don’t need to earn righteousness you have a complete 100% righteousness imputed to you.
The moment you deviate and attempt to earn righteousness you are under the Law and if you fail you bring wrath upon yourself.
So the solution is accept through faith the imputed righteousness of God. And anything you do, say as Elihu said
“"I will fetch my knowledge from afar, And I will ascribe righteousness to my Maker.” Job 36:3
In other words don’t take credit for anything you do but ascribe the righteous acts to God.
It is because trying to achieve righteousness through the Law and failing (which you will) brings wrath, righteousness is received by faith and you don’t need to earn it. You receive all the righteousness of God by faith and that’s how you benefit of the promises made freely, by grace, without breaking any laws and avoiding wrath. And this way it’s guaranteed to anyone whether they initially followed the Law or not, faith is the qualifier.
Let's take a look at the whole chapter.
Romans 4 (DRB)1 What shall we say then that Abraham hath found, who is our father according to the flesh. 2 For if Abraham were justified by works, he hath whereof to glory, but not before God. 3 For what saith the scripture? Abraham believed God, and it was reputed to him unto righteousness. 4 Now to him that worketh, the reward is not reckoned according to grace, but according to debt. 5 But to him that worketh not, yet believeth in him that justifieth the ungodly, his faith is reputed to righteousness, according to the purpose of the grace of God. 6 As David also termeth the blessedness of a man, to whom God reputeth righteousness without works: 7 Blessed are they whose iniquities are forgiven, and whose sins are covered. 8 Blessed is the man to whom the Lord hath not imputed sin.
Obviously he here means by justification in the sense of the initial and ultimate gaining of the status of righteous, not the justification that means retaining and remaining in that righteous state, which is distinct and has nothing to do with earning anything, but rather retaining what has been earned for you. As St. James says of Abraham, he was justified by works (Jas. 2:21), but only insofar as and in the sense that a faith without works is dead; and insofar as Abraham, having the choice to not follow up what He knows and believes with the corresponding deeds: "faith was made complete by works" (Jas. 2:22). These are the senses of 'justified' the two Apostles mean the justification of man: one initial and in the ultimate sense (by faith in Christ, by appropriating the grace He earned, and He could alone earn), and the other in the sense that we have the duty to be stewards of God's grace (Lk. 17:10), which involves living as righteously as the grace of God allows, "according to the measure of Christ" (Eph. 4:7), not living without or outside of the grace of God.
It's pure folly and foolishness to interpret St. Paul's teaching, "but to the one who does no work but believes in him who justifies" as true distinct from his tightly knit argument and particular sense, as meaning that St. James taught falsehood when he wrote that "faith, if it hath not works, is dead," (Jas. 2:17) and necessitates the ignoring of Paul's teaching elsewhere, such as "if I should have all faith, so that I could remove mountains, and have not charity, I am nothing" (1 Cor. 13:2), or "circumcision matters nothing, and uncircumcision matters nothing: only the observance of the commandments of God" (7:19).
For both Apostles, if works do not follow, that faith is dead and useless. So both teach the necessity of works, and neither teach that works necessarily 'flow' without or consent, as is too prevalent a teaching today (usually phrased in the form 'you are 'trying' to work for salvation; true believers 'will' do good works if they are genuine'), and in this sense that works justify (that is, play into justification—not that they earn the grace by which they are saved).
For example, if Abraham was said to have faith in God, and justified, but we read, 'I will not sacrifice my son,' we would know the faith was dead faith, and not real. He would clearly not be justified before God.
St. Paul's point thus far is that amity or peace with God comes only through His mercy, something you can but accept, and something which clearly depends on Him—we don't initiate the appeal for our salvation, this is a conviction of the Spirit. It is not earned: even the state of being able to accept His mercy is itself the forbearance and patience of God! How could it be works? This is St. Paul's line of reasoning, not 'How could God expect you to be just? Just accept salvation!' a mockery of St. Paul: righteous living is a given, and often identified radically with the gospel, and found most plainly taught in the teaching of the Lord and Saviour Himself.
The man to whom sin is not imputed is not exempt from the guilt of sin because of His association with Christ—He has sought mercy for it.
The Psalm quoted itself, by parallelism, defines the non-imputation of sin as having been forgiven of it, not imperviousness to guilt:
Psalm 32:1-2 (DRB) ... Blessed are they whose iniquities are forgiven, and whose sins are covered. 2 Blessed is the man to whom the Lord hath not imputed sin, and in whose spirit there is no guile.
Notice also that the blessedness directly corresponds to the content of the soul, not some 'extrinsic declaration.'
9 This blessedness then, doth it remain in the circumcision only, or in the uncircumcision also? For we say that unto Abraham faith was reputed to righteousness. 10 How then was it reputed? When he was in circumcision, or in uncircumcision? Not in circumcision, but in uncircumcision. 11 And he received the sign of circumcision, a seal of the righteousness of the faith, which he had, being uncircumcised; that he might be the father of all them that believe, being uncircumcised, that unto them also it may be reputed to righteousness: 12 And might be the father of circumcision; not to them only, that are of the circumcision, but to them also that follow the steps of the faithful, that is in the uncircumcision of our father Abraham.
Faith, not circumcision is the medium by which Abraham, before and after the institution of circumcision, was justified.
13 For not through the law was the promise to Abraham, or to his seed, that he should be heir of the world; but through the righteousness of faith. 14 For if they who are of the law be heirs, faith is made void, the promise is made of no effect.
Since the promise was not made on the keeping of the Law, but freely, and by His benevolent love, it cannot be said to be received only by those who keep the Law of Moses, otherwise it is not a promise, but a deal.
15 For the law worketh wrath. For where there is no law, neither is there transgression. 16 Therefore is it of faith, that according to grace the promise might be firm to all the seed; not to that only which is of the law, but to that also which is of the faith of Abraham, who is the father of us all,
As you can see, the "therefore it is of faith" refers to the abovementioned point, that if the promise was made apart from the giving of the Law, it proves that it was something to be believed and looked forward to by faith. "For if the inheritance be of the law, it is no more of promise. But God gave it to Abraham by promise" (Gal. 3:18). The keeping of the law, he will write, was added because of transgression (not the moral law, obviously, it was in force since moral beings existed): "diverse washings, and ordinances of the flesh laid on them until the time of correction" (Gal. 3:19; Heb. 9:10).
17 (As it is written: I have made thee a father of many nations,) before God, whom he believed, who quickeneth the dead; and calleth those things that are not, as those that are. 18 Who against hope believed in hope; that he might be made the father of many nations, according to that which was said to him: So shall thy seed be. 19 And he was not weak in faith; neither did he consider his own body now dead, whereas he was almost an hundred years old, nor the dead womb of Sara. 20 In the promise also of God he staggered not by distrust; but was strengthened in faith, giving glory to God: 21 Most fully knowing, that whatsoever he has promised, he is able also to perform. 22 And therefore it was reputed to him unto righteousness. 23 Now it is not written only for him, that it was reputed to him unto righteousness, 24 But also for us, to whom it shall be reputed, if we believe in him, that raised up Jesus Christ, our Lord, from the dead, 25 Who was delivered up for our sins, and rose again for our justification.
The "therefore" translates δια τουτο which means "given this" or "consequently" (previously mentioned point about the promise not being made on keeping the Law).
1 I've replaced instances of the translation 'justice' with 'righteousness' according to the more familiar translation.