Badami was the capital of the Early Chalukyas, who ruled much of Karnataka and Andhra Pradesh between the 6th and 8th centuries. It was founded in 540 AD by Pulakesi I (535-566 AD), an early ruler of the Chalukyas. His sons Kirtivarman I (567-598 AD) and his brother Mangalesa (598-610 AD) constructed the cave temples. The greatest among them was Pulakesi II (610-642 AD) who defeated many kings but failed to capture Pallava's capital Kanchipuram.The rock-cut Badami Cave Temples were sculpted mostly between the 6th and 8th centuries. The four cave temples represent the secular nature of the rulers then, with tolerance and a religious following that inclines towards Hinduism, Buddhism and Jainism. cave 1 is devoted to Shiva, and Caves 2 and 3 are dedicated to Vishnu, whereas cave 4 displays reliefs of Jain Tirthankaras. Deep caverns with carved images of the various incarnations of Hindu gods are strewn across the area, under boulders and in the red sandstone. From an architectural and archaeological perspective, they provide critical evidence of the early styles and stages of the southern Indian architecture.The Pallavas under the king Narasimhavarman I (also called Mamalla Pallava) seized it in 642 AD. Vikramaditya I of Chalukyas drove back Pallavas in 654 AD. and led a successful attack on Kanchipuram, the capital of Pallavas [This statement needs reference]. The Rashtrakutas absorbed karnataka including Badami around 757 AD and the town lost its importance. Also see Chola-Chalukya wars.The Chola-Chalukya wars were a series of wars fought from 992 C.E. to 1120 C.E. between the Chola and the Chalukya kingdoms .It was occupied by the Hoysalas.