Har Rai's caution was tested by the Mughal war of succession. He is said to have shown kindness, by one account, the loan of rare medicine from his dispensary, to the prince Dara Shikoh, the liberal-minded heir defeated and executed by his brother Aurangzeb. When Aurangzeb, now emperor, summoned the Guru to Delhi to answer for this and for the contents of Sikh teaching, Har Rai did not go himself but sent his elder son, Ram Rai.
At court Ram Rai, to placate the emperor, altered a line of the scripture that Aurangzeb had found objectionable. Har Rai's response was decisive: he disowned his son for tampering with the Guru's word, and named instead his younger son, the five-year-old Har Krishan, as his successor. The episode fixed a principle the community would hold to, that the integrity of the scripture stood above the favour of kings and above the claims of birth.
Guru Har Krishan, installed at five years old on his father's word, held the office barely two years. Summoned to Delhi by Aurangzeb, he contracted smallpox while tending the sick of the city and died there in 1664, reportedly naming his successor with the words "Baba Bakala," directing the Panth to a village rather than a person and setting off the search that eventually found Tegh Bahadur. The disowning of Ram Rai and the choice of a young child over an adult claimant together established, early in Sikh history, that the office answered to fidelity to the Guru's teaching rather than to seniority, lineage seniority, or political convenience.