Guru Gobind Singh(The tenth Guru of Sikhs) lost The Battle of Chamkaur. He lost his elder two sons in the battle & only a few of his army could make out from the place. His other two sons(younger ones) & his Mother were captured & killed by Wazir Khan & his army.
After this incident, Guru Gobind Singh wrote a series of letters to Aurangzeb which can be found on the Internet with the name of "Zafarnama" which means "Epistle of Victory". In these letters, he emphasized that though he might have lost the battle but he has not lost this war between good & evil and his army will rise again & will keep fighting till the evil empire of Aurangzeb is destroyed.
Following is a famous verse from Zafarnama :-
When all has been tried, yet
Justice is not in sight,
It is then right to pick up the sword,
It is then right to fight
A lot from the original letters has been lost. But still it is worth a read. you can read it here
Then leaders from his re-united army swept the Mughals from Punjab(the Punjab before 1947). And rest is the history
Suggestion: Do read about Guru Gobind Singh & his Father who gave his life for the freedom to practice any religion, after you read Zafarnama. His father's writings were compiled into Sri Guru Granth Sahib(The holy book of Sikhs) by the name "Salok Mahala 9".