The story goes that Rangda, the mother of Erlangga, the King of Bali in the tenth century, was condemned by Erlangga's father because she practiced black magic.
After she became a widow, she summoned all the evil spirits in the jungle, the leaks and the demons, to come after Erlangga. A fight occurred, but she and her black magic troops were too strong that Erlangga had to ask for the help of Barong. Barong came with Erlangga's soldiers, and fight ensued.
Rangda casted a spell that made Erlangga soldiers all wanted to kill themselves, pointing their poisoned keris into their own stomachs and chests. Barong casted a spell that turned their body resistant to the sharp keris. At the end, Barong won, and Rangda ran away.