His saying, the Almighty: "So the angels prostrated, all of them together, except Iblis, he refused to be with the prostrators." The interpretation of Ibn Abbas: "Had Iblis not been of the angels, he would not have been commanded to prostrate."
Al-Hasan said: He was commanded by God to prostrate just as He commanded the angels; so he refused to prostrate with them. The creation of Iblis was from fire, and the creation of the angels was from light.
Muhammad said: "Except Iblis" is in the accusative case due to an exception (istithna') that is not from the first (category), as He, the Almighty, said: "For they are enemies to me, except the Lord of the worlds." The meaning is: But Iblis refused. This is according to the view of those who said that Iblis was not of the angels.
It was said: The name of Iblis was Azazil, and when God cursed him and became angry with him, he 'ablasa' (despaired) of His mercy; meaning: he lost hope, so He named him Iblis.
Surah Al-Hijr from verse (32) to verse (44).