Earlier, Ansari, currently lodged in the central jail in Agra since 2010 for his alleged role in the murder of a BJP legislator, had announced his candidature from Varanasi but later withdrew in the "larger interest" of minorities.
Ansari is accused of masterminding the murder of Ajay Rai's brother, Awadesh Rai
Fearing division of Muslim votes that could make the going easy for Bharatiya Janata Party's prime ministerial candidate Narendra Modi, who is also contesting from Varanasi, QED president Afzal Ansari Tuesday announced his party's support to Rai.
At a press conference, Afzal Ansari said Rai was capable of holding the flag of secularism in testing times and hence the party took the decision to support the Congress candidate.
The decision came as a surprise as Mukhtar Ansari is in jail on charges of ordering the killing of BJP legislator Krishnanand Rai, who was the brother of Ajay Rai.
In 2009, both Krishnanand Rai and Mukhtar Ansari had contested the polls from Varanasi, but BJP's Murli Manohar Joshi emerged victorious.
The QED has been repeating its demand for a joint candidate against Modi, and Afzal Ansari rued that his proposal was not been received favourably by the Bahujan Samaj Party, Aam Aadmi Party and the Samajwadi Party.
Varanasi will vote May 12 in the last round of the staggered 10-phase polls. AAP's Arvind Kejriwal is also contesting from the seat.
Afzal Ansari had earlier surprised everyone by saying there was a "Modi wave" in the country and that the Gujarat chief minister would win in Varanasi.