Allah did indeed fulfil His promise to you when ye with His permission Were about to annihilate your enemy,-until ye flinched and fell to disputing about the order, and disobeyed it after He brought you in sight (of the booty) which ye covet. Among you are some that hanker after this world and some that desire the Hereafter. Then did He divert you from your foes in order to test you but He forgave you: For Allah is full of grace to those who believe.
They followed what the evil ones gave out (falsely) against the power of Solomon: the blasphemers Were, not Solomon, but the evil ones, teaching men Magic, and such things as came down at babylon to the angels Harut and Marut. But neither of these taught anyone (Such things) without saying: "We are only for trial; so do not blaspheme." They learned from them the means to sow discord between man and wife. But they could not thus harm anyone except by Allah's permission. And they learned what harmed them, not what profited them. And they knew that the buyers of (magic) would have no share in the happiness of the Hereafter. And vile was the price for which they did sell their souls, if they but knew!
Now, when trouble touches man, he cries to Us: But when We bestow a favour upon him as from Ourselves, he says, "This has been given to me because of a certain knowledge (I have)!" Nay, but this is but a trial, but most of them understand not!
Those who believed and those who suffered exile and fought (and strove and struggled) in the path of Allah,- they have the hope of the Mercy of Allah: And Allah is Oft-forgiving, Most Merciful.
Echoes in the Quran
Phrases from this ayah that also appear in other places. A reading aid, not a ruling.