I was going through this question about animals attaining Moksha.
According to story, both elephant and crocodile were the devotees of the the Lord Vishnu in previous life. In the plot of the story, elephant named the Gajendra(King Indradyumna in previous life) was drowned in to the lake by a crocodile(Huhu, a ghandarva in previous life). The crocodile caught the elephant's leg and was dragging him to the deep water. The story end like this, Lord Vishnu appears and escapes Gajendra from crocodile by killing the crocodile with the weapon 'Sudarsana Chakra' and then the elephant got the Moksha.
So the question goes here, even though it is known as 'Gajendra Moksha', actually the moksha was given to the crocodile also. And crocodile got the 'rare privilege'(same as in the case of Ravana, Kamsa,etc.) of getting killed by the hands of Lord Vishnu and was given moksha before the Gajendra. The crocodile was actually trying to kill the devotee elephant who prayed Lord Vishnu with this famous prayer,
शुक्लांबरधरं विष्णुं शशि वर्णं चतुर्भुजं ।
प्रसन्न वदनं ध्यायेत सर्व विघ्नोपशान्तये॥
But the moksha was first given to the crocodile who had not at all prayed to Lord and also we can not find any form of devotion directly to Lord Vishnu or any other Gods from the crocodile. But in the case of Gajendra, he was chanting and praying the name of Lord Vishnu with total devotion. Still he was second compared to the crocodile in attaining Moksha. What is the reason? Why was the true devotee elephant Gajendra second? Or what was the particular form of karma or devotion method of crocodile which lead to attaining moksha?