The Pandavas had counted on Shalya joining their side with his huge army. On the way to assist the Pandavas in the Kurukshetra War, Shalya was tricked by Duryodhana, who arranged a huge feast for Shalya and his men. When Shalya was impressed by the hospitality of his host who he mistakenly thought to be Yudhisthira, he offered to be at his host's service. Unable to turn down Duryodhana's request to join the Kauravas, Shalya met Yudhisthira and apologized for his error. Yudhishtira knowing that Shalya was a great charioteer and forecasting that Shalya would someday be asked to be the charioteer of Karna, extracted a vow from Shalya to the effect that Shalya will demoralise Karna and dampen his spirits. Yudhishtira, a person of immaculate character, for once, stooped to a low level. It is still unclear as to why Yudhishtira did so. Anyway, Shalya assured the Pandavas that he would do everything possible to demoralise Karna and dampen his spirits.
Shalya reluctantly entered the Kurukshetra war on the Kauravas' side. Shalya served as Karna's charioteer during the latter's battle with Arjuna, while continuously praising the Pandava prince and citing Karna's shortcomings. Shalya took over the leadership of the Kaurava army on the eighteenth and last day of the great battle after the death of Karna when it was becoming rapidly clear that the war was a lost cause, and close to the end of the battle he was killed by Prince Yudhishtira with a spear. Shalya was the second to last Kaurava commander-in-chief and after his death, the Kauravas were left leaderless and broke ranks fleeing from the slaughter despite Duryodhana's best efforts.