Escorted by a large posse of security personnel, Ansari, whose Quami Ekta Dal is supporting Congress in Varanasi and who is contesting from Ghosi constituency, was released after his wife Afshan furnished a bond of Rs 1.27 lakh.
The gangster-turned politician, who lost to Bharatiya Janata Party leader Murli Manohar Joshi by just 17,000 votes in Varanasi in 2009, was taken in an ambulance to his constituency of Ghosi accompanied by his wife and other members of the family.
Ansari, facing trial in a case under stringent Maharashtra Control of Organised Crime Act for allegedly being a member of an organised crime syndicate, was granted custody parole on May 1 for 10 days by a Delhi court for campaigning in Lok Sabha polls.
Ansari's wife complained that the release of her husband was delayed though she had submitted the bond amount.
The ambulance was followed by vehicles carrying police and PAC personnel, officials said.
After campaigning ends today, Ansari would be lodged either in a nearby jail or a police station for the night before being brought back to Agra Central Jail tomorrow.
Meanwhile, earlier yesterday an intensive search was carried out in Ansari's cell by authorities after reports that he was carrying out his election campaign from jail. However, after a six-hour search nothing objectionable was found, police sources said.
Voting for Ghosi seat is scheduled on May 12 in the last phase.
The court had allowed the plea filed by Ansari, who is also an accused in the 2005 murder case of BJP MLA Krishnanand Rai, in which he said he was required to campaign for the polls.
The 2005 murder case was transferred from Ghazipur in Uttar Pradesh to Delhi by the Supreme Court last year on a plea filed by Alka Rai, wife of Krishnanand Rai.
A sitting legislator from Uttar Pradesh's Mau constituency, Ansari is also facing trial in Delhi in a case under Maharashtra Control of Organised Crime (MCOCA) for being a member of an organised crime syndicate run by co-accused Prem Prakash alias Munna Bajrangi.
The Special Cell of Delhi Police had arrested Bajrangi in October, 2009 for allegedly threatening South Delhi businessman Ashok Tebriwal to extort Rs one crore after it intercepted their telephonic conversation.
The police had lodged an FIR against Ansari, who is said to be close to Bajrangi, after it found that he was also allegedly a part of the organised crime syndicate.