Mayavi is a demon, son of Maya, who challenges Vali at night. Vali chases him into a cave; the misunderstanding that follows turns Vali against Sugriva.
Vali pursues Mayavi into a cave and tells Sugriva to wait outside. After a year blood and roars flow from the cave, and Sugriva, thinking his brother dead, seals the entrance and is made king.
Vali, having killed Mayavi, breaks out, accuses Sugriva of treachery and drives him away.