The story that sets Vishvamitra on his course begins with a meal. King Kaushika, hunting with his army, is entertained by the sage Vasishtha, who feeds the entire force from the wish granting cow Shabala. The king offers to buy the cow, is refused, and tries to take her. She produces armies from her own body that destroy his, and his hundred sons are burned by the sage's power. The king's conclusion is not that he needs a larger army but that he has been fighting the wrong kind of strength.
What follows is told as a promotion through ranks. He undertakes austerities and is acknowledged rajarshi, a royal seer, which he refuses as insufficient. He continues and is called rishi, then maharshi. Each stage is interrupted, by anger, by desire, by being provoked, and each interruption costs him the accumulated merit and has to be begun again. The title he wants, brahmarshi, requires acknowledgement by Vasishtha himself, the man whose cow he tried to steal and whose sons he later kills. It comes only when he has stopped demanding it.
The tradition treats this as its clearest statement that the brahmin condition is a state attained rather than a birth received, and it treats the difficulty of the climb as the reason the exception is rare rather than as an argument that the door is shut. It also treats the tale as a study in temper, which is why the failures are preserved at the same length as the successes.