C.E. Mahmud advanced towards Kashmir and tried entering the kingdom via the Toshamaidan Pass. His progress was checked by the strong Loharkot Fort, which he besieged for a month. Owing to the heavy snowfall, which cut off Mahmud's communications, he was compelled to retreat. However, the Sultan again set out to invade Kashmir in September–October, 1021 C.E, but was again compelled to retreat due to bad weather conditions. Establishment of Muslim rule and conversion to Islam After Sultan Mahmud's attempted conquests, Kashmir remained generally unaffected by invasions that were aimed at the plains of India, up until 1320 C.E. The Loharas (1003-1320 C.E.) ruled during this period, and was the last of the Hindu dynasties of Kashmir. In the spring of 1320, a Mongol chieftain by the name of Zulju, invaded Kashmir via the Jhelum Valley route. Suhadeva (1301–20 C.E), last ruler of the Loharas, tried to organise resistance, but failed due to his unpopularity among the masses. The reason for this unpopularity was financial exaction and general misrule that prevailed during the end period of the Lohara Dynasty. Zulju's invasion created havoc and Suhadeva fled to Kistwar. Rinchana, son of a Ladakhi chief, who was employed by Ramachandra (Prime Minister of Kashmir) to establish law and order, took advantage of the chaos. He got Ramachandra murdered, occupied the Kashmir throne by the end of the year 1320, and ruled until his death in 1323 C.E. In order to gain acceptance of Kashmiris, he married Kota Rani, the daughter of Ramachandra, and made Rawanchandra (Ramachandra's son) his commander-in-chief. Rinchan converted to Islam after coming into contact with Sayyid Sharfudin, a Sufi preacher commonly known as Bulbul Shah, who had come to Kashmir during the reign of Suhadeva. He changed his name to Sultan Sardarudin Shah after converting to Islam and thus became the first Muslim ruler of Kashmir. Following the conversion of Rinchan, his commander in chief also became Muslim. The royal patronage for Islam won it new converts and according to one source, many Kashmiris embraced the creed of Bulbul Shah. The period after Sultan Sardarudin's death was marked by chaos and power tussle. Udayanadeva, the brother of Suhadeva, was made the ruler after an agreement among the nobles. However, he proved to be incompetent, and it was Kota Rani who was the virtual ruler. Soon after Udayanadeva's accession, a foreign chieftain attacked Kashmir, but the invaders were successfully