Soon the fame of the pool, spread far and wide and the followers of the Guru hastened to build houses in so auspicious a neighbourhood, thus giving rise to a small town. Guru Ram Das had also planned the erection of a temple on a small island in the midst of the tank, but before his plans could mature the call came for him and he left it to his son and successor Guru Arjan Dev, the fifth Guru, to build the historic centre of Sikh devotion.
Tradition has it that for his work of building the temple, Guru Arjan Dev drew architectural inspiration from the shrine of the Muhammadan saint Mian Mir, near Lahore and was even actually assisted by the saint himself. Tradition goes so far as to assert that to acknowledge the assistance rendered by Mian Mir, Guru Arjan invited him to lay the first stone of the temple. The legend runs that unfamiliar with and unaccustomed to mason's work the saint could not lay the stone straight, at which one of the mistris standing by set it right.
On its completion the temple first came to be known as Hari Mandir. A flourishing stay soon grew up around the holy site and from this time onward the fortunes of Amritsar rose and fell with those of the Sikhs, who had, before the death of Guru Arjan, come to be a great and growing sect in Punjab. Muslim bigotry and persecution soon drove the peace-loving Sikhs to resort to arms and to resist Imperial power. Guru Har Gobind , son of Ram Das and the sixth Guru, first openly opposed and defeated a force sent against him by the Governor of Lahore. But ultimately he was obliged to leave Punjab and died in an exile. Amritsar had in the meanwhile ceased to be the headquarters of the Gurus which were transferred to the city of Kartarpur in the Jullundur District. The Granth or the Sacred Book was removed there and was replaced in the Hari Mandir by a copy. Guru Gobind Singh, the tenth and last Guru of the Sikhs had organised his followers into a great religious-military Commonwealth known by the name Khalsa. In Khalsa all men were equal, and all were soldiers but they could not regain Amritsar. It was after his death, through a long and bitter struggle that his chosen friend and disciple Bairagi Banda was able to return to Amritsar. Henceforth Amritsar became the centre of constant warfare, waged with varying fortune by the Sikhs at first against the Imperial Governors of Lahore, and afterwards against the Afghan conqueror, Ahmad Shah Durani.
The city was taken again and again by the Mussalmans though at the end the Sikhs always succeeded in recapturing it. Thus the struggle went on till 1761 when Amritsar suffered the most terrible episode in its history. After inflicting a crushing defeat upon the Sikh force at the second Battle of Panipat Ahmad Shah Durani pursued the remnants across the Sutlej River, attacked Amritsar, destroyed the city, blew up the temple with gunpowder, filled in the sacred tank with mud and defiled the holy place by slaughter of cows-thus fulfilling the prophecy of Mian Mir regarding the destruction of the shrine. With the departure of Durani, however, phoenix-like rose the city again from its ashes and the Sikhs initiated a final struggle which resulted in the secure establishment of their political independence. They rebuilt the temple, enlarged the city, and Amritsar became for a while the capital of the Punjab.
The city was divided between the various Sikh chiefs, each of whom possessed a separate ward as his private State. But the greater part of the city soon fell into the hands of the Bhangi Confederacy who remained in supreme possession till 1802 when Ranjit Singh, who had previously obtained possession of Lahore, seized Amritsar and incorporated it within his dominions. On annexing Amritsar Ranjit Singh spent large sums of money in beautifying the city. His first care was the temple which he roofed with sheets of gilded copper, whence the name-the Golden Temple. His surrounded the city with massive and battlemented walls, part of which still remains, built the fort of Govindgarh which to this day stands on the north-west of the city garrisoned by British troops. The Maharaja also planned and laid a beautiful garden on the spot where stood a fort, the stronghold of the chief of the Bhangian mistry from whose hands he had wrested Amritsar. The garden was built at a cost of two-and-a-quarter lakhs with a summer palace inside it encircled by a solid masonry wall ringed round by a moat. Presently this garden which was encircled serves as the Amritsar Club.