Their story is clear evidence of the perfection of Allah’s power: all affairs are in His hand, and He leads astray whom He wills and guides whom He wills. How many a person who wandered in error has Allah guided, and how many who were upon guidance has He allowed to stray—may Allah protect us.
Reflect, too, on the hadith of ʿAbd Allah ibn Masʿud (may Allah be pleased with him) in which the Prophet ﷺ said: “A man may act with the deeds of the people of Paradise until there remains between him and it only an arm’s length, yet what has been written overtakes him and he acts with the deeds of the people of Hell and enters it. Likewise, a man may act with the deeds of the people of Hell until there remains between him and it only an arm’s length, yet what has been written overtakes him and he acts with the deeds of the people of Paradise and enters it.” In other words, a person may continue acting until only a short span—or “an arm’s length”—remains before his appointed time, then death comes and the decree overtakes him.
The second hadith, narrated by ʿAmr ibn al-ʿĀṣ (may Allah be pleased with him), states that the Prophet ﷺ said: “When a judge rules and exerts himself and is correct, he receives two rewards; if he errs, he receives one.” Here “judge” refers to the qadi, though the same ruling applies to the mufti. Meaning: when someone strives to reach the truth, and something of that truth becomes clear to him, then issues a fatwa or renders judgment accordingly, he is upon goodness. If he is right, he earns two rewards; if he is mistaken, he still earns one.
Allah never lets the reward of those who do good be lost. Thus, when a person strives, seeks the truth, and applies his utmost effort, Allah will reward him for that endeavor. If he is correct, he gains two rewards—one for reaching the truth and another for his striving. If he is mistaken, he still gains one reward for having exerted himself and expended every effort in the search for truth.