So any ruler who is a Muslim is legitimate according to classical scholars.
Therefore, to evaluate whether the ruler in any one land is/was a Muslim, we turn to the scholars of that land who understand Islam and their reality better than we do. So, I assume a ruler is a Muslim until proven otherwise by the scholars of his land.
Specifically, therefore, until I see the Takfir of Ghaddafi from the scholars of his land, or the Takfir of any ruler from the scholars of his land, then I do not make such Takfir just because some politically motivated people do so. An example of this is Shaykh Ramadan al-Buti's and Syrian Ulema's lack of Takfir on the Syrian leader Bashar Asad.