For more than a century the last Mughal emperor was almost forgotten - but a chance finding of his grave helped resurrect the legacy of a man revered as a Sufi saint and one of the finest poets in the Urdu language.
Only a handful of relatives were present when Bahadur Shah Zafar II breathed his last in a shabby wooden house in Rangoon (now Yangon) in 1862.
That very day, his British captors buried him in an unmarked grave in a compound near the famous Shwedagon Pagoda.
Defeated, demoralised and humiliated, it was an inglorious end for a man whose Mughal ancestors had for 300 years ruled a vast territory including modern-day India, Pakistan, large parts of Afghanistan and Bangladesh.
Though his rule could not compare with that of illustrious ancestors like Akbar or Aurangzeb, he became the rallying point for the failed "Indian uprising" of 1857, when soldiers from undivided India rose against the British East India Company.
After they lost, the emperor was tried for treason, imprisoned and exiled to other territory under British control, in what is now Myanmar (Burma).
He died in custody on 7 November aged 87 - but his poetry lived on. The pen name he used, Zafar, means victory.
The great Mughal empire had lost much of its influence and territory by the end of the 1700s. When Zafar came to the throne in 1837, his rule extended only to Delhi and its surroundings. But for his subjects, he always remained Badshah - the King.
Like other Mughal emperors he's said to be a direct descendent of Mongol rulers such as Genghis Khan and Timur. With his death, one of the world's greatest dynasties came to an end.
The British buried him in an unmarked grave to keep his followers away. News of his death took a fortnight to reach India and almost went unnoticed.
Then, for more than 100 years, Zafar faded from memory.
But in recent decades interest in his legacy has been revived.
A 1980s Indian TV serial rekindled memories, and roads bear his name in Delhi and Karachi. Dhaka renamed a park after him.
"Zafar was a remarkable man," historian William Dalrymple, author of The Last Mughal, told the BBC.
"A calligrapher, notable poet, Sufi pir [spiritual guide], and a man who valued the importance of Hindu-Muslim unity."
"While Zafar was never cut out to be a heroic or revolutionary leader, he remains, like his ancestor the Emperor Akbar, an attractive symbol of Islamic civilisation at its most tolerant and pluralistic," writes Mr Dalrymple in his book.
Zafar's religious tolerance, some suggest, also reflects his mixed parentage. His father, Akbar Shah II, was Muslim while his mother, Lal Bhai, was a Hindu Rajput princess.
The 1857 'Mutiny'
- Indian soldiers rose up against their British officers in the northern city of Meerut on 10 May. The rebellion spread to Delhi, Agra, Lucknow and Kanpur.
- Resentment had grown over attempts to impose new reforms, laws, Western values and Christianity.
- The revolt united thousands of Hindu and Muslim troops who chose then-Mughal emperor, Bahadur Shah Zafar II, as their nominal head.
- British generals deployed Sikh soldiers from Punjab and Pathans from the North-West Frontier Province - Delhi was recaptured by September.
- Both sides were accused of indiscriminate killings. The rebels killed British women and children. The British were blamed for mass executions of thousands of mutineers and their supporters.
- The rebellion officially ended by July 1858. In the same year, the East India Company was abolished in favour of direct rule of India by the British government.
Source: Britannica, BBC History
Zafar's unassuming tomb in a quiet avenue in Yangon is a poignant and silent reminder of one of the most tumultuous periods of Indian history.
Though local people knew Zafar was buried somewhere inside the compound of the local cantonment - where he and his family members were confined - they didn't find it until 1991.
Workers digging for a drain came across a brick structure which turned out to be the former king's grave. It was later renovated with the help of public donations.
Compared with his ancestors' grand mausoleums in India, Zafar's tomb is modest. An arched iron-grill bears his name and title. The ground floor houses the graves of one of his wives, Zinat Mahal, and his grand-daughter, Raunaq Zamani.
In a crypt beneath, Zafar's grave is strewn with rose petals and other flowers.
A long chandelier hangs above, while paintings of him hang on the walls. There is a mosque next door.
The dargah or shrine has become a pilgrimage site for Yangon's Muslim population.
"People from all walks of life come to the dargah because he's considered a Sufi saint," says Al-Haj U Aye Lwin, treasurer of the management board of the Bahadur Shah Zafar Mausoleum.
"They come to meditate and pray near his grave. When people's wishes are fulfilled they donate money and other things."
Zafar is particularly remembered for his mystical work in Urdu. His ghazals about life and love are famous and often sung or read out in Yangon's mushairas, gatherings at which Urdu poetry is recited.
Banned from using pen or paper, he is said to have written in charcoal on the walls that confined him. A few of the poems attributed to him have been reproduced in the mausoleum.
As an emperor, Zafar did not command an army but he became the symbolic head of a revolt which united both Muslims and Hindus. Historians point out that thousands of soldiers from both religions came together to rebel against their British officers in support of restoring Mughal rule.
This year - 2017 - is the 160th anniversary of the uprising but it is barely being marked, whether in India or elsewhere.
At a time when nationalism and fundamentalism are on the rise, historians say Zafar's religious tolerance remains relevant to this day.
He may have lost his title and dynasty. But he succeeded in conquering hearts and lives on as a Sufi saint and mystical poet.