ittham gajendrah sa yadapa sankatam
pranasya dehi vivaso yadrcchaya
aparayann atma-vimoksane ciram
dadhyav imam buddhim athabhyapadyata
ittham—in this way; gaja-indrah—the King of the elephants; sah—he; yada—when; apa—obtained; sankatam—such a dangerous position; pranasya—of life; dehi—who is embodied; vivasah—circumstantially helpless; yadrcchaya—by the will of providence; aparayan—being unable; atma-vimoksane—to save himself; ciram—for a long time; dadhyau—began to think seriously; imam—this; buddhim—decision; atha—thereupon; abhyapadyata—reached.
When the King of the elephants saw that he was under the clutches of the crocodile by the will of providence and, being embodied and circumstantially helpless, could not save himself from danger, he was extremely afraid of being killed. He consequently thought for a long time and finally reached the following decision.
Everyone in the material world is engaged in a struggle for existence. Everyone tries to save himself from danger, but when one is unable to save himself, if he is pious, he then takes shelter of the lotus feet of the Supreme Personality of Godhead. This is confirmed in Bhagavad-gita (7.16):
Four kinds of pious men—namely, one who is in danger, one who is in need of money, one who is searching for knowledge and one who is inquisitive—begin to take shelter of the Supreme Personality of Godhead in order to be saved or to advance. The King of the elephants, in his condition of danger, decided to seek shelter of the lotus feet of the Lord. After considerable thought, he intelligently arrived at this correct decision. Such a decision is not reached by a sinful man. Therefore in Bhagavad-gita it is said that those who are pious (sukrti) can decide that in a dangerous or awkward condition one should seek shelter of the lotus feet of Krsna.
Link to this page: https://prabhupadabooks.com/sb/8/2/31