Junagadh, then called Girnar, was the capital of Gujarat under the Mauryas from the 4th century BC until the reign of Emperor Ashoka who embraced Buddhism. After his death (c 226 BC), it passed into the successive control of the Kshatrapas, Guptas and finally the Chudasanas. Hindu dominance lasted till around the middle ages, when Muslim invaders established their supremacy. It remained under Muslim rule till India's independence. Then, in keeping with the wishes of the local population, and contrary to those of the ruling Nawab of Junagadh, it became part of the Indian Union of States.