Valmiki in his earlier life was known as Ratnakara – a highway robber. It is said that he attained knowledge by repeating the name of Sri Rama in the reverse – MARA. The story narrates the glory of the name Rama.
Ratnakara used to loot the people who used to travel through the forest. Ratnakara once attacked the group of seven saints who had nothing to offer to the robber other than the name of Rama.
The seven sages told about the glory of the name Rama and the treasure it can unfold. The told him that the name is the key to the true treasure.
Ratnakara was completely immersed in practicing Adharma that he was unable to utter the word ‘Rama.’
The sages then as a solution asked him to repeat the name in the reverse order. Thus Ratnakara started chanting the name in reverse order: Mara
Mara…Mara…Mara soon became Rama… Rama…Rama.
In course of time Ratnakara became so fond of repeating the name that he became a pious saint.
Note – another story suggests that it was a meeting with Sage Narada that changed the course of life of Ratnakara.