Srimad-Bhagavatam: Canto 1 - Chapter 1 - Verse 23
यथा हृषीकेश खलेन देवकीकंसेन रुद्धातिचिरं शुचार्पिता ।विमोचिताहं च सहात्मजा विभोत्वयैव नाथेन मुहुर्विपद्गणात् ॥ २३ ॥
yathā hṛṣīkeśa khalena devakīkaṁsena ruddhāticiraṁ śucārpitāvimocitāhaṁ ca sahātmajā vibhotvayaiva nāthena muhur vipad-gaṇāt
O Hṛṣīkeśa, master of the senses and Lord of lords, You have released Your mother, Devakī, who was long imprisoned and distressed by the envious King Kaṁsa, and me and my children from a series of constant dangers.
Devakī, the mother of Kṛṣṇa and sister of King Kaṁsa, was put into prison along with her husband, Vasudeva, because the envious King was afraid of being killed by Devakī’s eighth son (Kṛṣṇa). He killed all the sons of Devakī who were born before Kṛṣṇa, but Kṛṣṇa escaped the danger of child-slaughter because He was transferred to the house of Nanda Mahārāja, Lord Kṛṣṇa’s foster father. Kuntīdevī, along with her children, was also saved from a series of dangers. But Kuntīdevī was shown far more favor because Lord Kṛṣṇa did not save the other children of Devakī, whereas He saved the children of Kuntīdevī. This was done because Devakī’s husband, Vasudeva, was living, whereas Kuntīdevī was a widow, and there was none to help her except Kṛṣṇa. The conclusion is that Kṛṣṇa endows more favor to a devotee who is in greater dangers. Sometimes He puts His pure devotees in such dangers because in that condition of helplessness the devotee becomes more attached to the Lord. The more the attachment is there for the Lord, the more success is there for the devotee.