This is the opening scene of Bahadur Shah Zafar, a television serial directed by Baldev Raj Chopra that Doordarshan had shown in 1986. The image of the last Mughal emperor, a descendent of Babur and Akbar, now frail and bound in chains, standing trial in what was once his court, was heart-wrenching. The title score made it poignant.

Zafar (1775-1862) may have been an ineffective emperor, whose rule did not extend beyond the Red Fort, but he was an accomplished poet, having been taught first by Ibrahim Zauq and then by Asadullah Khan Ghalib. William Dalrymple, in his 2006 book, The Last Mughal, calls Zafar "a serious mystical poet" and a "ghazal writer of great charm and accomplishment".

And this was his best-known ghazal, his signature composition. In popular imagination, it evoked Zafar's despondence and self-pity when he was banished to Burma after the 1857 Mutiny, where he died five years later. Mohammad Rafi rendered it in his melodious voice for the 1960 film, Lal Qilla, which picturised Zafar singing the ghazal.

What few people noticed was the name that appeared briefly on the screen when the credits began to roll: Muztar Khairabadi. That name shouldn't have been there at all. Khairabadi was not a contemporary of Zafar, Zauq and Ghalib. Now it emerges, even the ghazal shouldn't have been there - neither in the TV series nor in Lal Qilla. If recent events are to be believed, this haunting poem was written not by Zafar but by Khairabadi who was born in 1865 - three years after Zafar died.

The authorship of the ghazal has been a matter of debate for a while. Earlier this month, a five-volume set of books, Khirman (Harvest), firmly put Khairabadi's stamp on the ghazal. These tomes, running into thousands of pages, contain verses of Khairabadi compiled by his grandson, poet Javed Akhtar. Na kisi ki aankh ka noor hoon... is a part of this collection.

Khairabadi has been dead for almost 90 years. His works were never published during his lifetime. After all these years, that this ghazal should finally claim to be his is quite a story in itself.

Khairabadi, or Syed Iftikhar Hussain Rizvi, was a magistrate who served in Khairabad, Tonk, Gwalior, Indore, Bhopal and Rampur. "While moving out of Bhopal in 1923, he left many of his papers behind which a friend kept safely with the intention of returning them to Khairabadi one day," says Urdu poet and writer Obaid Azam Azmi who worked on the Khirman anthology over the last few years.

But the two friends never met again. Khairabadi died in 1927. Years later, the friend's family handed over those papers to Khairabadi's son and Akhtar's father, the poet Jan Nisar Akhtar. Among them were Khairabadi'sghazals and couplets. Jan Nisar Akhtar, it seems, edited and put them together to be published one day. But he died in 1976.

Khairabadi's work lay forgotten in a carton, buried under letters, newspaper cuttings and mundane bills in Jan Nisar Akhtar's house in Bandra. The carton would later be sent to Akhtar. But it would be many more years before he would find the time to go through its contents. Among them, written in black ink on a yellowing piece of paper, was the ghazal, Na kisi ki aankh ka noor hoon... .

Akhtar couldn't be contacted for this report, but those who know him say he was taken by surprise at this revelation. "It was a shock for him when he found the ghazal handwritten by his grandfather stacked right at the bottom of the carton," says Prithvi Haldea, co-founder of Ibaadat Foundation that is working to keep alive the legacy of legendary Urdu poets.

If the ghazal was always Khairabadi's, how did it come to be attributed to Zafar? Four volumes of Zafar's collected works (Deewan-i-Zafar) were published during his lifetime by Munshi Naval Kishore (1836-1895). "This ghazal does not find mention in any of them," says Aqil Ahmad, the secretary of Ghalib Academy in Delhi.

Dalrymple, in his book, quoting research done by Imran Khan of Lahore, says the ghazal does not feature even in Hazoor-i-wala, a periodical in which Zafar published his poems, and it was first made popular by Pakistani ghazal singer Habib Wali Muhammad in Radio Ceylon's talent show, Ovaltine Amateur Hour, though he doesn't mention Khairabadi's name. (He adds that there are doubts about the authorship of another ghazal popularly believed to have been written by Zafar, Lagta nahi hai dil mera …, or nothing brings happiness to my heart...) Later, Rafi would take its popularity to greater heights.

Till 1958, this ghazal was not mentioned in any recognised Urdu book, according to Azmi. It had only been recited in mushairas and mehfils from where it travelled to ghazal singers and qawwals. And from there it found its way to the thin, cheap one- or two-anna paperback called Guldasta, he says.

These books had no authenticity. Somewhere, sometime, the ghazal got published as that of Zafar in one edition of Guldasta. It reflected the same mood and tone as many of Zafar's other ghazals did. "It was immediately accepted as Zafar's," says Azmi. "Most of the people, who have heard this ghazal, are of the view that only a doomed emperor like Zafar could create self-pity of the sort expressed in these lines," adds Firoz Bakht Ahmed, columnist and grandnephew of Maulana Abul Kalam Azad.

Then in 1958, for the first time, a reputed Urdu scholar, Khalil-ur-Rehman Azmi, included the ghazal in his book, Nawa-e-Zafar. "He put it down in the Shubaha (doubt) section and clearly mentioned that he had found the ghazal through Guldasta and other such publications," says Azmi.

Still, it strengthened the ghazal's association with Zafar. "And yet, there was no clear chain that could establish how this ghazal, said to have been written by Zafar while in exile in Rangoon, found its way from kaidkhana to chhaapakhana (prison to publisher)," says Azmi.

"It was a shock to me to have to make this mental adjustment (that the ghazal was not Zafar's but Khairabadi's)," says Frances W Pritchett, professor emerita of Modern Indic Languages at the department of Middle Eastern, South Asian and African Studies at Columbia University. In an article, the professor who also teaches Urdu poetry, writes that there is little evidence that Zafar composed poetry after his four pre-1857 compendiums.

"After that, there is nothing. There are various reports of Zafar composing verses both during the Mutiny (some martial verses attributed to him apparently were in oral circulation at the time) and even after it, while in British captivity in the Red Fort (supposedly by scratching with a charcoal-tipped stick on the whitewashed wall of his prison chamber)," she writes. By this time Zafar was in his 80s and weak and had possibly become senile.

Not everybody is convinced. Sitting in his office, surround by piles of papers and books, Aqil Ahmad of Ghalib Academy pulls out a thin hard-bound book that has a contrarian view from Mumbai-based poet-critic Shamin Tariq. "I don't deny that the ashaar (couplets) that Zafar recited after 1857 have not all been preserved safely. Those of other poets have also been included in them," Ahmad reads from the book.

Speaking on phone from Mumbai, Tariq says, "Some other poets can stake claim on some couplets but the complete ghazal is Zafar's." The ghazal, he adds, does not reflect the helplessness of just one person, but mourns the loss of a whole generation, of the India of old.

In different versions, this ghazal has appeared in different forms. What Rafi sings in Lal Qilla is different from what Khairabadi has written on that yellowing piece of paper, and the version in Khalil-ur-Rehman Azmi's book reads slightly differently. Either the order of the couplets has changed or words have changed their position. In some places, old words have been replaced by new.

But that's not unusual. "While ghazals were recited and shared, seasoned poets would sometimes correct them or change a word here or there," Tariq says. "Every line of a couplet has wazan (weight). Together, the two lines of the couplet have to balance each other. Sometimes, when one poet felt this balance was missing in a fellow poet's sher, he would correct it."

That, he says, is probably what Khairabadi did with Zafar's ghazal. "He has taken care of its health and balanced it out wonderfully." And maybe he added a few couplets of his own, he says.

Here again there are variations. Sometimes the ghazal appears with three couplets and in some places with five. The ghazal that Akhtar has found written by his grandfather has seven couplets. "Zafar's ghazals were known to have five couplets, while Khairabadi's had seven," says Azmi.

There is one crucial giveaway. "The last couplet has his takhallus (signature, here in the form of his name)," says Pavan Kumar Varma, the author of Ghalib: The Man, The Times. The last couplet attributed to Khairabadi reads:
"Na main Muztar unka habeeb hoon, na main Muztar unka raqeeb hoon; (Neither is Muztar her dear, nor is he her confidant;
jo palat gaya woh naseeb hoon, jo ujad gaya woh dayaar hoon." ( I am the fate that turned bad, the house that got destroyed).

But the question about the uncanny similarity in the tone found in Zafar's ghazal remains. Azmi explains, "Khairabadi's maternal grandfather, poet and philosopher Maulvi Fazl-i-Haq Khairabadi, was a freedom fighter who played an important role in 1857. He was later banished to the Andamans." In a sense, his despondence and hopelessness were similar to what Zafar experienced. Perhaps this ghazal reflects that, hence the similarity.

He adds that Na kisi ki aankh ka noor hoon… wasn't really received well by Khairabadi's contemporaries. "They didn't think it lived up to his calibre." One of his contemporaries, Mumtaz Ali Aah, in a book he wrote on Ameer Minai, another poet of that time, criticised Khairabadi for the ghazal that "is popular only in song, but if you put it on paper, it is lightweight and not worth a mention".

Tariq still holds out that the ghazal is Zafar's. "It was part of the appeal published in Rangoon seeking contributions for Zafar's grave," he maintains. And so the literary debate continues. For now, it is advantage Khairabadi.