Sir Robert Anderson addresses this point, writing that "There are two alternative principles on which alone justification is now theoretically possible. The one is by man's deserving it; the other is through God's unmerited favour. Let a man, from the cradle to the grave, be everything he ought to be, and do everything he ought to do; let him, as our author puts it, love God with all his heart, and his neighbour as himself walking 'purely, humbly, and beneficently while on earth,' and such an one will 'inherit eternal life.' But all such pretensions betoken moral and spiritual ignorance and degradation. All men are sinners; and being sinners they are absolutely dependent upon grace " (Andersom, The Silence of God, [Kregel Publications, 1978], p.100).
So the Lord Jesus told the rich young man that in order to have eternal life he must keep the Law in order to convict that man of his sinfulness. Instead of walking away his proper response should have been the same as the publican in the following verses:
"Two men went up into the temple to pray; the one a Pharisee, and the other a publican. The Pharisee stood and prayed thus with himself, God, I thank thee, that I am not as other men are, extortioners, unjust, adulterers, or even as this publican. I fast twice in the week, I give tithes of all that I possess. And the publican, standing afar off, would not lift up so much as his eyes unto heaven, but smote upon his breast, saying, God be merciful to me a sinner. I tell you, this man went down to his house justified rather than the other: for every one that exalteth himself shall be abased; and he that humbleth himself shall be exalted" (Lk.18:10-14).
"But he that shall endure unto the end, the same shall be saved. And this gospel of the kingdom shall be preached in all the world for a witness unto all nations; and then shall the end come" (Mt.24:13-14).
By the context we can understand that the word "end" is referring to the end of the great tribulation:
"But pray ye that your flight be not in the winter, neither on the sabbath day: For then shall be great tribulation, such as was not since the beginning of the world to this time, no, nor ever shall be" (Mt.24:20-21).
It will be those who endure to the end of the tribulation period "physically" who will be saved "physically" by the Lord Jesus when he returns to the earth:
"In that day shall the Lord defend the inhabitants of Jerusalem...And it shall come to pass in that day, that I will seek to destroy all the nations that come against Jerusalem...Then shall the Lord go forth, and fight against those nations, as when he fought in the day of battle. And his feet shall stand in that day upon the mount of Olives, which is before Jerusalem on the east" (Zech.12:8-9;14:3-4).
"As he spake these words, many believed on him. Then said Jesus to those Jews which believed on him, If ye continue in my word, then are ye my disciples indeed...Ye are of your father the devil" (Jn.8:30-21,44).
Those who say that those who lived under the law had no eternal security quote these verses to attempt to prove this idea. They say verses 30-31 show people who believed on Christ but verse 44 shows that these same people did not continue in faith.
The following words give an example of men whose faith that was not rooted in their hearts:
"Now when he was in Jerusalem at the passover, in the feast day, many believed in His name, when they saw the miracles which he did. But Jesus did not commit Himself unto them, because He knew all men" (Jn.2:23-24).
These men were not "born of God" and therefore "children of God" or else the Lord Jesus would indeed commit Himself to them. Their belief that His name was not based on His word but instead on the miracles which they saw Him perform.
Saving faith is not merely a mental knowledge of the gospel. Instead, true faith is defined as believing in one's "heart" (Ro. 10:10; Acts 8:37). The Lord spoke of a faith that could not save in the parable of "the sower and the soils": "But he that received the seed into stony places, the same is he that heareth the word, and immediately with joy receiveth it; Yet hath he not root in himself, but endureth for a while: for when tribulation or persecution ariseth because of the word, by and by he is offended" (Mt. 13:20-21). The "faith" spoken of here was not "rooted" in the heart.