Muslims at the height of their civilization were one of the major contributors of arts and sciences. People like Al-Kindi and Al-Farabi were first to recover and translate the Greek philosophy and introduced this wisdom in Spain and Europe. Avicenna and other Muslim intellectual’s treatises on philosophy, medicine and other sciences were part of western curricula. There was no fragmentation of disciplines and nor was a distinction between worldly and spiritual. Science flourished with and in light of religion. [for reference, see comments below]
In contrast, when there were internal conflicts among Muslim dynasties, where they fall into prey of politics and orthodoxy, the decline was inevitable. There wasn’t any more the pluralistic mindset of Fatimids and no intellectual honesty like the one which was nurtured in Al-Azhar mosque which later flourished into university. Such dogma had roots in misinterpretation of Islamic ethics. Ethics which should have served as a bridge between faith and society1 but forsaking the use of intellect for ethical considerations, its roots became so feeble that it lost practically. Therefore, there was no desire left to improve upon (to imagine, discover and enlighten); there was only a quest to cling upon the past.