Srimad-Bhagavatam: Canto 3 - Chapter 1 - Verse 27


यस्यानवद्याचरितं मनीषिणोगृणन्त्यविद्यापटलं बिभित्सव: ।निरस्तसाम्यातिशयोऽपि यत्स्वयंपिशाचचर्यामचरद्‍गति: सताम् ॥ २७ ॥


yasyānavadyācaritaṁ manīṣiṇogṛṇanty avidyā-paṭalaṁ bibhitsavaḥnirasta-sāmyātiśayo ’pi yat svayaṁpiśāca-caryām acarad gatiḥ satām


Although no one in the material world is equal to or greater than Lord Śiva, and although his unimpeachable character is followed by great souls to dismantle the mass of nescience, he nevertheless remains as if a devil to give salvation to all devotees of the Lord.


Lord Śiva’s uncivilized, devilish characteristics are never abominable because he teaches the sincere devotees of the Lord how to practice detachment from material enjoyment. He is called Mahādeva, or the greatest of all demigods, and no one is equal to or greater than him in the material world. He is almost equal with Lord Viṣṇu. Although he always associates with Māyā, Durgā, he is above the reactionary stage of the three modes of material nature, and although he is in charge of devilish characters in the mode of ignorance, he is not affected by such association.