Srimad Bhagavatam Canto 06, Chapter 01, Text 27

SB 6.1.27

sa evam vartamano ’jño
 mrtyu-kala upasthite
matim cakara tanaye
 bale narayanahvaye
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
When the time of death arrived for the foolish Ajamila, he began thinking exclusively of his son Narayana.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
In the Second Canto of the Srimad-Bhagavatam (2.1.6) Sukadeva Gosvami says:
 
etavan sankhya-yogabhyam
 svadharma-parinisthaya
janma-labhah parah pumsam
 ante narayana-smrtih
 
“The highest perfection of human life, achieved either by complete knowledge of matter and spirit, by acquirement of mystic powers, or by perfect discharge of one’s occupational duty, is to remember the Personality of Godhead at the end of life.” Somehow or other, Ajamila consciously or unconsciously chanted the name of Narayana at the time of death (ante narayana-smrtih), and therefore he became all-perfect simply by concentrating his mind on the name of Narayana.
 
It may also be concluded that Ajamila, who was the son of a brahmana, was accustomed to worshiping Narayana in his youth because in every brahmana’s house there is worship of the narayana-sila. This system is still present in India; in a rigid brahmana’s house, there is narayana-seva, worship of Narayana. Therefore, although the contaminated Ajamila was calling for his son, by concentrating his mind on the holy name of Narayana he remembered the Narayana he had very faithfully worshiped in his youth.
 
In this regard Srila Sridhara Svami expressed his verdict as follows: etac ca tad-upalalanadi-sri-narayana-namoccarana-mahatmyena tad-bhaktir evabhud iti siddhantopayogitvenapi drastavyam. “According to the bhaktisiddhanta, it is to be analyzed that because Ajamila constantly chanted his son’s name, Narayana, he was elevated to the platform of bhakti, although he did not know it.” Similarly, Srila Viraraghava Acarya gives this opinion: evam vartamanah sa dvijah mrtyu-kale upasthite satyajño narayanakhye putra eva matim cakara matim asaktam akarod ity arthah. “Although at the time of death he was chanting the name of his son, he nevertheless concentrated his mind upon the holy name of Narayana.” Srila Vijayadhvaja Tirtha gives a similar opinion:
 
mrtyu-kale deha-viyoga-laksana-kale mrtyoh sarva-dosa-papa-harasya harer anugrahat kale datta-jñana-laksane upasthite hrdi prakasite tanaye purna-jñane bale pañca-varsa-kalpe pradesa-matre narayanahvaye murti-visese matim smarana-samartham cittam cakara bhaktyasmarad ity arthah.
 
Directly or indirectly, Ajamila factually remembered Narayana at the time of death (ante narayana-smrtih).
Srimad Bhagavatam Canto 06, Chapter 01, Text 26
Srimad Bhagavatam Canto 06, Chapter 01, Text 28-29