Narrated from Wahb: The Lord of the worlds created the fire of Sammun. From this Fire of Sammun He created the Jinn. “And the Jinn created We before of fire flaming” (Al-Hijr: 27). The first of the Jinn was named Marij and the Lord created second one to be his wife, and she was named Marija. They had a son and they called him Jinn. From them derived all the clans of the Jinn, including Iblis. And the Lord gave them the earth to dwell therein. And they lived and worshipped there for a long time. So much did they worship that the angels grew amazed, and said to the Lord of the Heavens and Earth; “Oh our Lord, raise them up to heaven, so that we might learn from them and follow their good example.” So the Lord brought Iblis, then named Azazil, up to be among the angels and he lived with them in the first heaven. Others remained living on earth and, remained righteous, while a number of them became sinners and transgressed the Law, as did the children of Adam (Alayhis salaam) after them.
And the earth began to complain of them to the Lord. “Oh my Lord, have you created me that I should be peopled by disobedient-folk?.” The Lord answered “Oh earth, be patient, I shall send prophets among them to lead them back to the straight path.” Until that time no prophets had appeared among the Jinn. The Lord sent to them 800 prophets and they killed each one of the prophets. At last the Lord spoke to Azazil in the first heaven. And He said to him “Go. Azazil. Go and fight the unbelievers of your people living on earth.” Azazil obeyed and descended onto earth and fought the unbelievers, vanquishing them then the Lord sent down a fire from the skies and it consumed them, so not a trace remained. The only Jinn left alive were the believing and worshipping Jinn.
Again Azazil prayed so eagerly that he was raised up into the first heaven, or according to one narration, he worshipped so much in the first heaven that he was raised up through all the seven heavens and above them. He worshipped on the earth. He worshipped on the heavens, until Adam (Alayhis Salaam) was brought into existence. Then the Lord ordered all the angels to bow down before Adam (Alayhis Salaam).and all the angels obeyed except Iblis.
Narrated From Hassan Al-Basri (Rahimahullah): Iblis worshipped above the seven heavens for more than 70,000 years, until he was raised to the station of Ridwan which is very high station, Ridwan being the guardian of Paradise. Iblis was the guardian of Paradise for 1000 years. Once he read an inscription on the gates of paradise, and it read: “There is a servant among the most highly favoured servants of the Almighty Lord, and for a long time he will be obedient and serve his Lord well; there will come a day, however, on which he will oppose his Lord and disobey, and he will be driven from His gates and be cursed.” Iblis, who was then still called Azazil, read and wondered at this prediction. “How can that be.” He asked. “that one of the closest servants to the Lord should grow disobedient to the Lord of the Worlds and be driven from His Holy Nearness? Oh Lord!, he pleaded. Give me permission to curse that rebellious one, whoever he may be.” The Lord gave him permission, and Iblis showered curses upon that future sinner for one thousand years, knowing not that it was to be himself.
There is a conflict of opinion between people as to whether Iblis was of the Angels or of the Jinn. But it is written in the Holy Quran, “he was one of the Jinn and committed ungodliness against his Lord’s command.”
Because of his extreme virtue and the intensity of his prayers, The Lord raised him up into the heavens to live among the angels. When the Lord ordered them all to bow down and prostrate before Adam (Alayhis Salaam), he refused and his hidden evil was exposed.