Once Lord Mahavir arrived in the city of Rajgruhi. He was accompained  by the royal sage (Rajarshi) Prasannachandra. Rajarshi Muni used to  execute severe penance simply by staring at the fire-emitting Sun, with  his one leg up and both arms raised straight. Magadha king Shrenik was  completely impressed by such severe penance and politely questioned Lord  Mahavir, “O Lord, suppose this monk performing severe penance, passes  away at this particular moment, what state would he achieve after his  death?” 
Lord Mahavir said, “He is Prasannachandra Rajarshi. In case he dies  at this very moment, he would possess the condition from the seventh  hell (narak).”
The gathering was shocked to hear this. King Shrenik was puzzled; he  thought that a saint’s soul by no means could go to hell. How was it  then that Lord Mahavir forecast such a ‘narak’ for Muni Prasannachandra?  Thinking that perhaps he had not listened to the Lord’s utterance  properly, king Shrenik asked again, “O Lord ! In the event that this  sage Prasannachandra dies at this moment, what state his soul would  attain?”
Lord Mahavir said, “He would attain liberation.”
Equally puzzled by these words of Lord Mahavir, king Shrenik said,  “Lord, in the first instance you said that he would attain the state of  narak and now within just a few seconds you say that he would attain the  moksha state – the ultimate liberation. Why such contradictory  statements?”
Lord said, “When you asked the first time, the monk had just heard  Durmukh saying that king Dadhivahan of Champanagari had attacked and had  laid a siege to the city of king Prasannachandra. His ministers had  betrayed Prasannachandra and had conspired to deprive him of the kingdom  by killing the child-king. On listening this, Monk Prasannachandra’s  mind was occupied by the thought of his kingdom and child and soon his  mind became a battlefield of violent and aggressive thoughts. As a  result, he was entangled in such namkarma (karma that determines  destinies and body type) like gati-jati etc. which would have sent him  to the seventh hell. Supposedly, he died in such a violent state of  mind, he would surely have gone to hell. Prasannachandra, fighting a  battle in his mind, touched his head to ensure that he had his helmet on  before making a fatal attack on the enemy king.
As soon as he touched his completely shaven head, he was awakened to  the reality. Soon he began to think, “Though I am engaged in saintly  penance, I did indulge in violent thoughts. I almost performed cruel  sinful deeds. Awakened to such a realization, monk Prasannachandra felt  repentant. Having critically reviewed his serious lapse, the monk once  again concentrated on quiet meditation. Hence when king Shrenik asked  Lord Mahavir the second time, the monk had already become worthy of the  state of liberation. By this time divine music surrounded  Prasannachandra Muni. Lord Mahavir said, “He has attained ‘kevalgyan’ –  pure and absolute knowledge. Gods rejoice at this moment of attaining  pure knowledge.”
Monk Prasannachandra’s character-sketch acquaints us with a  self-vigilant monk. What a wonderfully vigilant soul! One who would be  awakened to self-realization by just touching the shaven head ! His  repentance being that of an awakened soul, he attained pure and absolute  knowledge.
 http://www.tattvagyan.com/jain-stories/shri-prasannachandra-rajarshi/