Sraddhatraya Vibhaga Yoga-Bhagavad Gita Chapter 17 [The Three Divisions of Material Existence]
Krishna Said > Shaloka: 19
And those penances and austerities which are performed foolishly by means of obstinate self-torture, or to destroy or injure others, are said to be in the mode of ignorance.
There are instances of foolish penance undertaken by demons like Hiranyakasipu, who performed austere penances to become immortal and kill the demigods. He prayed to Brahma for such things, but ultimately he was killed by the Supreme Personality of Godhead. To undergo penances for something which is impossible is certainly in the mode of ignorance.