The Arabs tried to invade India but they were defeated by the north Indian king Nagabhata of the Pratihara Dynasty and by the south Indian Emperor Vikramaditya II of the Chalukya dynasty in the early 8th century.