The Tangut kingdom of Xixia employed Tibetan Buddhists skilled in war magic in their court. When the kingdom was laid to siege by Chinggis Khan, one such cleric summoned Mahakala on the battlefield, forcing the Mongols to retreat.
The Mongols themselves would later invoke Mahakala to their aid during the conquest of China under Qubilai Khan, defeating not just the Chinese armies, but the Chinese God of War Zhenwu himself. Mahakala would become the state deity of the Yuan Mongols.