Guru Gobind Singh fortified Anandpur with a ring of forts, Anandgarh, Fatehgarh, Lohgarh and Holgarh among them, built to withstand the conflict his growing community increasingly drew from neighboring hill rajas and from the Mughal state. The town was besieged repeatedly in the early 1700s, and in December 1704, after a prolonged siege and a promise of safe passage that was broken once the Guru's forces left the fortifications, Anandpur was evacuated under attack; the Guru's two younger sons were captured and executed at Sirhind not long afterward, and two elder sons died in the battle at Chamkaur, a sequence of losses central to how the events at Anandpur are remembered within Sikh tradition.
The festival of Hola Mohalla, which Guru Gobind Singh instituted at Anandpur as a counterpart to the Hindu festival of Holi, replaced its color throwing with displays of martial skill, mock battles and horsemanship performed by the Nihang orders of Sikh warriors, and it remains the largest annual gathering at the city, drawing crowds that rival Vaisakhi itself. Today Anandpur Sahib functions as a major pilgrimage center built around its historic gurdwaras and forts, its economy and civic life organized substantially around the rhythm of these two annual festivals and the steady year round flow of visiting Sikhs.