According to the legend, it is said that Baba Atal Rai wanted to restore the life of his friend who had passed away. When Guru Hargobind said that 'one must not use spiritual power for their personal benefit', Baba Atal Rai replied that he would lay his life to revive his friend who was a son of a widow. Through the chants and prayers, Baba Atal Rai took his last breath and his friend was revived. Therefore, in the honour of his bravery and the sacrifice he made for his friend, Gurudwara Baba Atal Sahib was built post his death. Even though only the older generation who have advanced spiritual learnings are known as Baba, Baba was added to Atal Rai's name for his sacrifice. Each storey out of the 9 floors in the Gurudwara represents the life of Baba Atal as he grew till the age he passed away, therefore it was built besides Harimandir Sahib which is dedicated to his father.