Bhagavad Gita Chapter 17, Text 19

Bg 17.19

mudha-grahenatmano yat
pidaya kriyate tapah
parasyotsadanartham va
tat tamasam udahrtam

Word for word: 
mudha — foolish; grahena — with endeavor; atmanah — of one’s own self; yat — which; pidaya — by torture; kriyate — is performed; tapah — penance; parasya — to others; utsadana-artham — for the sake of causing annihilation; va — or; tat — that; tamasam — in the mode of darkness; udahrtam — is said to be.

Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada:
Penance performed out of foolishness, with self-torture or to destroy or injure others, is said to be in the mode of ignorance.

Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada:
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.