According to the Mahabharata, the Pandavas spent their 13th year of exile in disguise (Agyat Vaas) in the Matsya kingdom. King Virata ruled Matsya and sheltered them during this year. Yudhishthira served as a court counselor, Arjuna as a eunuch dance teacher, and the others in various disguises. This period culminated in the Matsya alliance in the Kurukshetra war.