The Srimad Bhagavata Purana was written by Vedavyasa, the rishi who re-organized the Veda, so that the teachings and revelations of the vedic seers would be better preserved and transmitted from guru to disciple. The story of Ajamila (skanda VI, chapter 1) is just one of the stories from it.
Ajamila was a Brahmana, who lived in the city of Kanya Kubja many, many years ago. Due to his birth, parentage and social upbringing, he was a young man who maintained all the practices and observances of a righteous life. He was virtuous and pure hearted, lived in an austere way, was learned in the Vedas and other scriptures and followed the ways of conduct written there. He accorded due respect to his parents and elders, was friendly and helpful to all, moderate in his speech and had his senses well under control. One day, however, he was lead off in a most unruly fashion by the senses and the mind, leaving behind the scriptures, the study and the observances. He took up a lifestyle the very opposite of austere. He fell in love with a prostitute and without any real way to support her and the ten sons they eventually had, he took to gambling, highway robbery, stealing and corruption. So he spent the remainder of his years until he was eighty-eight years old, when our story begins.
Narayana, the youngest son, was most dear to his parents. His father, Ajamila, was completely besotted by him. Absorbed in his life, Ajamila was completely unaware of greater forces at work. He did not feel his lifetime ebbing away and he did not even consider that his own death was approaching. One day there appeared three of the fiercest creatures imaginable, carrying huge ropes, grinning and beckoning horribly. Ajamila did not even recognize the attendants of Yama (the Lord of Death).
Struck with fright, he screamed aloud to his child playing nearby, "Narayana, Narayana." At this cry from the dying man (who hadn't even realized he was dying), the attendants of Lord Vishnu came rushing to Ajamila's side, blocking the attendants of Yama, who roared angrily, "Who are you to obstruct the order of Dharmaraja, the Lord of Justice?" The attendants of Lord Vishnu, however, were equally adamant, and replied challengingly, "If you are indeed the attendants of Lord Dharmaraja, then you would be able to tell us the essence of dharma and its signs."
A heated debate began on dharma and adharma, and the effects of acts of merit and demerit. The attendants of Yama recounted Ajamila's previous history, which even by the simplest calculations of accumulated merit and demerit didn't look very promising. They argued that his unrighteous conduct far outweighed and negated his observances of the Vedas and other scriptures. Also, they argued, the lords of Vishnu had no right to interfere in the first place, as Ajamila had just been calling his son. Yet Vishnu's attendants stood firm, and proclaimed, "Whosoever utters the Lord's name, even by accident, calls for protection." Furthermore, they countered, "As a fire consumes fuel, so the Lord's name, whether chanted with or without knowledge of the greatness of the name, destroys the unrighteous elements in a person. A powerful medicine, though taken by someone unaware of its properties, is still effective."
Defeated, the attendants of Yama returned empty-handed. Ajamila immediately left for Haridwar, where he sat on the banks of the river practising the yoga of devotion.
For those who aspire for liberation, there is nothing more powerful than the chanting of the Lord's name. If this can rescue Ajamila, the Srimad Bhagavata tells us, what to say of the results that can be obtained by chanting the name of Hari with faith and devotion.