Guru Tegh Bahadur purchased the land and founded the town in 1665, naming it Chak Nanaki after his mother, and later, once fortified and expanded by his son, it took the name Anandpur, the City of Bliss. Guru Gobind Singh, who became the tenth Guru after his father's execution in 1675, made Anandpur his base and, on the Vaisakhi gathering of 1699, called the Sikh community together and asked, according to the traditional account, for volunteers willing to give their lives.
Five men stepped forward, one after another, and are remembered as the Panj Pyare, the five beloved ones; each is described as having been led into a tent, after which Guru Gobind Singh emerged with a sword marked with blood, until all five had gone in and come out alive, the fifth time revealing that the blood had come from a goat. He then initiated the five with Amrit, sweetened water stirred with a double-edged sword, founding the Khalsa, the order of initiated Sikhs bound to a shared code and a set of outward articles of faith, and in a further reversal of hierarchy asked the five to initiate him in turn, so that the Guru became, in the phrase Sikhs use, both the father and the child of the Khalsa he had founded. Takht Sri Kesgarh Sahib, built on the site of that gathering, is counted among the five Takhts, seats of temporal and religious authority, alongside the Akal Takht at Amritsar.