The Delhi High Court on Monday refused to release gangster-turned-politician Mukhtar Ansari on parole for canvassing in the ongoing Uttar Pradesh polls.

Justice Mukta Gupta set aside the trial court's order granting bail to Ansari till March 4 to campaign and said: "A right to contest the election cannot imply that the candidate gets a right to be released from jail for canvassing as a candidate for being elected.

"If the candidate is in custody for an alleged offence, it would be the discretion of the court to release him or not, depending on the facts and circumstances of the case," the court added.

When a person in custody fills up nomination as a candidate, he "does not get a vested right" to be released for canvassing, said the court.

It said he (candidate in jail) runs the risk of not being released on bail to contest election from custody.

Ansari is contesting from Mau Sadar on a Bahujan Samaj Party ticket.

The High Court had on February 17 stayed the custody parole after the Election Commission moved the court seeking its cancellation on the ground that Ansari might influence witnesses in the 2005 murder case.

A special court in Delhi earlier granted bail to Ansari in the murder case of Bharatiya Janata Party (BJP) legislator Krishnanand Rai for which he is facing trial.

The Uttar Pradesh government and the complainant in the case also opposed Ansari's release from a Lucknow jail. 

The poll panel had said that Ansari's release may create fear in the minds of the voters if he was allowed to roam around in the constituency.

Rai, along with six supporters, was shot dead at Bhanwarkol in Ghazipur district on November 29, 2005. The case was transferred from Ghazipur to Delhi by the Supreme Court in 2013 on a plea filed by Alka Rai, wife of the murdered BJP leader.

A four-time legislator from Mau Sadar, Ansari is in jail since 2005. He has more than 40 criminal cases against him, including murder and kidnapping. 

The BSP had welcomed him and his family in January after his Qaumi Ekta Dal merged with the party ahead of the Uttar Pradesh elections.