The Guptas performed Vedic sacrifices to legitimize their rule, but they also patronized Buddhism, which continued to provide an alternative to Brahmanical orthodoxy. The military exploits of the first three rulers - Chandragupta I (ca. 319–335), Samudragupta (ca. 335–376), and Chandragupta II (ca. 376–415) —brought much of India under their leadership. They successfully resisted the North-Western Kingdoms until the arrival of the Hunas who established themselves in Afghanistan by the first half of the 5th century, with their capital at Bamiyan. Nevertheless, much of the Deccan and southern India were largely unaffected by this state of flux in the north.