Initiation into the Khalsa helped to unify the community for the trials that were soon to come. Were it not for Guru Gobind Singh’s genius, there surely would not be a Sikh community today. The remainder of Guru Gobind Singh’s reign was marked by fierce wars as the Sikh community defended itself against the repeated attacks of the local Hindu chiefs and the Mughal forces. Although Sikhs were usually outnumbered, they were not crushed and today are remembered for their bravery and devotion. In 1704, the Sikhs were forced to evacuate Anandpur. In the melee that followed, two of Guru Gobind Singh’s sons were killed. The other two were captured and tortured to death. But even these tragedies did not destroy the spirit of the community.
In 1708 the Guru was treacherously stabbed by assassins who had entered his camp as friends. He managed to kill one of them, and the other was killed by his guards. Although Guru Gobind Singh received treatment for his wounds, they were severe; some days later, while stringing his bow, the wounds opened again. The Guru assembled his followers, installed the Guru Granth Sahib as Guru, and bade farewell to the community.
Guru Gobind Singh did, however, outlive the Mughal Emperor Aurangzeb who died in 1707. At the time of Guru Gobind Singh’s death, he had sided with Bahadur Shah in the complex struggle for Mughal succession. In the disorder of these years, Banda Singh established an area of Sikh rule in parts of the Punjab. “Raj karega Khalsa!” (“The Khalsa shall rule!”) was the cry. The attempt was short-lived, lasting only from 1712 to 1716, but the groundwork was laid for the future. For much of the 18th century, the Sikhs were under threat and siege from both Afghans and Mughals, caught in the crossfire of wars and vengeance. From about the 1760s, however, Sikhs were the de facto rulers of many parts of the Punjab.
By the end of the eighteenth century, a leader named Ranjit Singh had assembled a force strong enough to gain power in the city of Lahore, which became the seat of a Sikh kingdom for forty years. He extended his power to Amritsar in 1802, consolidating the various Sikh confederacies under his control. Ranjit Singh had consummate diplomatic skills and included Muslim and Hindu officers in his administration. After his death in 1839, the Sikh kingdom fell into disarray, and in 1849, the British Empire was able to annex the Punjab.