Maharaja Ranjit Singh, the empire was weakened by east India British company stoking internal divisions and political mismanagement. Finally, by 1849 the state was dissolved after the defeat in the Second Anglo-Sikh War. Background Mughal rule of Punjab The Sikh religion began around the time of the conquest of the Northern Indian subcontinent by Babur, the founder of the Mughal Empire. His conquering grandson, Mughal Emperor Akbar, supported religious freedom and after visiting the langar of Guru Amar Das got a favourable impression of Sikhism. As a result of his visit, he donated land to the langar and the Mughals did not have any conflict with Sikh gurus until his death in 1605. His successor Jahangir, however, saw the Sikhs as a political threat. He ordered Guru Arjun Dev, who had been arrested for supporting the rebellious Khusrau Mirza, to change the passage about Islam in the Adi Granth. When the Guru refused, Jahangir ordered him to be put to death by torture. Guru Arjan Dev's martyrdom led to the sixth Guru, Guru Hargobind, declaring Sikh sovereignty in the creation of the Akal Takht and the establishment of a fort to defend Amritsar. Jahangir attempted to assert authority over the Sikhs by jailing Guru Hargobind at Gwalior, but released him after a number of years when he no longer felt threatened. The Sikh community did not have any further issues with the Mughal empire until the death of Jahangir in 1627. The succeeding son of Jahangir, Shah Jahan, took offence at Guru Hargobind's "sovereignty" and after a series of assaults on Amritsar forced the Sikhs to retreat to the Sivalik Hills. The next guru, Guru Har Rai, maintained the guruship in these hills by defeating local attempts to seize Sikh land and playing a neutral role in the power struggle between two of the sons of Shah Jahan, Aurangzeb and Dara Shikoh, for control of the Mughal Empire. The ninth Guru, Guru Tegh Bahadur, moved the Sikh community to Anandpur and travelled extensively to visit and preach in defiance of Aurangzeb, who attempted to install Ram Rai as new guru. Guru Tegh Bahadur aided Kashmiri Pandits in avoiding conversion to Islam and was arrested by Aurangzeb. When offered a choice between conversion to Islam and death, he chose to die rather than compromise his principles and was executed. Formation of the Khalsa Guru Gobind Singh assumed the guruship in 1675