Srimad Bhagavatam Canto 04, Chapter 06, Text 45

SB 4.6.45

tvam karmanam mangala mangalanam
kartuh sva-lokam tanuse svah param va
amangalanam ca tamisram ulbanam
viparyayah kena tad eva kasyacit
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
O most auspicious lord, you have ordained the heavenly planets, the spiritual Vaikuntha planets and the impersonal Brahman sphere as the respective destinations of the performers of auspicious activities. Similarly, for others, who are miscreants, you have destined different kinds of hells which are horrible and ghastly. Yet sometimes it is found that their destinations are just the opposite. It is very difficult to ascertain the cause of this.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
The Supreme Personality of Godhead is called the supreme will. It is by the supreme will that everything is happening. It is said, therefore, that not a blade of grass moves without the supreme will. Generally it is prescribed that performers of pious activities are promoted to the higher planetary systems, devotees are promoted to the Vaikunthas, or spiritual worlds, and impersonal speculators are promoted to the impersonal Brahman effulgence; but it sometimes so happens that a miscreant like Ajamila is immediately promoted to the Vaikunthaloka simply by chanting the name of Narayana. Although when Ajamila uttered this vibration he intended to call his son Narayana, Lord Narayana took it seriously and immediately gave him promotion to Vaikunthaloka, despite his background, which was full of sinful activities. Similarly King Daksa was always engaged in the pious activities of performing sacrifices, yet simply because of creating a little misunderstanding with Lord Siva, he was severely taken to task. The conclusion, therefore, is that the supreme will is the ultimate judgment; no one can argue upon this. A pure devotee therefore submits in all circumstances to the supreme will of the Lord, accepting it as all-auspicious.
 
tat te ’nukampam susamiksamano
bhuñjana evatma-krtam vipakam
hrd-vag-vapurbhir vidadhan namas te
jiveta yo mukti-pade sa daya-bhak
 
(Bhag. 10.14.8)
 
The purport of this verse is that when a devotee is in a calamitous condition he takes it as a benediction of the Supreme Lord and takes responsibility himself for his past misdeeds. In such a condition, he offers still more devotional service and is not disturbed. One who lives in such a disposition of mind, engaged in devotional service, is the most eligible candidate for promotion to the spiritual world. In other words, such a devotee’s claim for promotion to the spiritual world is assured in all circumstances.
Srimad Bhagavatam Canto 04, Chapter 06, Text 44
Srimad Bhagavatam Canto 04, Chapter 06, Text 46