When those unbelievers were plotting against you to imprison you or to kill or expel you: they were plotting and Allah was plotting, but Allah is the Best of Planners . (Surat al-Anfal, 8:30)
Those who plotted against the just religion throughout history strove to distance people from it for their own selfish desires (e.g., greed for power, personal interests, and so on). In the Hereafter, they will be told: “No, it was your scheming night and day when you commanded us to reject Allah and assign equals to Him.” (Surah Saba', 34:33) Yet there is a very important point that we need to remember here:
Those before them plotted, but all planning belongs to Allah. He knows what each self earns, and the unbelievers soon will know who has the Ultimate Abode. (Surat ar-Ra‘d, 13:42)
As is related in the verse above, “all planning belongs to Allah.” Thus, against all of the unbelievers' plots, Allah devises the best plan. Allah calls attention to the deadlock facing unbelievers:
They concocted their plots, but their plots were with Allah, even if they were such as to make the mountains vanish. (Surah Ibrahim, 14:46)
As this verse relates, Allah protects all believers from these pl ots. This is very easy for Allah, Who turns all plots against His Messengers and believers into failures and makes unbelievers suffer the ensuing dire consequences, for “… Allah is swifter at planning...” (Surah Yunus, 10:21)
No doubt, Allah creates every incident with a purpose and for the ultimate good. He uses the unbelievers' plots against believers to test them. He then extends His help to those servants who can discern the good and beauties in the events He creates, and turns all of these to their benefit.