The history of Kashmir is intertwined with the history of the broader Indian subcontinent in South Asia with minor influences from the surrounding regions of Central Asia and East Asia. Historically, Kashmir referred to only the Kashmir Valley in Jammu and Kashmir, India. Today, it denotes a larger area that includes the Indian-administered union territories of Jammu and Kashmir (which consists of Jammu and the Kashmir Valley) and Ladakh, the Pakistan-administered territories of Azad Kashmir and Gilgit-Baltistan, and the Chinese-administered regions of Aksai Chin and the Trans-Karakoram Tract.In the first half of the 1st millennium, the Kashmir region first became an important centre of Hinduism and later—under the Mauryas and Kushanas—of Buddhism. Later in the ninth century, during the rule of the Karkota Dynasty, a native tradition of Shaivism arose. It flourished in the seven centuries of Hindu rule, continuing under the Utpala and the Lohara dynasties, ending in mid-14th century.Islamization in Kashmir began during the 13th century, accelerated under Muslim rule during the 14th and 15th centuries, and led to the eventual decline of the Kashmir Shaivism in Kashmir.In 1339, Shah Mir became the first Muslim ruler of Kashmir, inaugurating the Shah Mir dynasty. For the next five centuries, Muslim monarchs ruled Kashmir, including the Mughal Empire, who ruled from 1586 until 1751, and the Afghan Durrani Empire, which ruled from 1747 until 1819. That year, the Sikhs, under Ranjit Singh, annexed Kashmir. In 1846, after the Sikh defeat in the First Anglo-Sikh War, the Treaty of Lahore was signed and upon the purchase of the region from the British under the Treaty of Amritsar, the Raja of Jammu, Gulab Singh, became the new ruler of Kashmir. The rule of his descendants, under the paramountcy (or tutelage) of the British Crown, lasted until 1947, when the former princely state became a disputed territory, now administered by three countries: India, Pakistan, and the People's Republic of China.EtymologyAccording to folk etymology, the name "Kashmir" means "desiccated land" (from the Sanskrit: ka = water and shimīra = desiccate). In the Rajatarangini, a history of Kashmir written by Kalhana in the mid-12th century, it is stated that the valley of Kashmir was formerly a lake.According to Hindu mythology, the lake was drained by the great rishi or sage, Kashyapa, son of Marichi, son of Brahma, by cutting the gap in the hills at Baramulla (Varaha-mula). When Kashmir had been drained, Kashyapa asked Brahmins to settle there. This is still the local tradition, and in the existing physical condition of the country, we may see some ground for the story which has taken this form. The name of Kashyapa is by history and tradition connected with the draining of the lake, and the chief town or collection of dwellings in the valley was called Kashyapa-pura, which has been identified with Kaspapyros of Hecataeus (apud Stephanus of Byzantium) and Kaspatyros of Herodotus (3.102, 4.44). Kashmir is also believed to be the country meant by Ptolemy's Kaspeiria. Cashmere is an archaic spelling of Kashmir, and in some countries it is still spelled this way.