Ansari, a 33-year-old Mumbai resident, was detained by Pakistani intelligence agencies in the year 2012 for entering the country illegally to reportedly meet a girl had befriended online. He had entered the country from Afghanistan with a fake Pakistani identity card and was sentenced to three years imprisonment by a military court in 2015.
After being sentenced by the military court, Ansari was lodged in the Peshawar Central jail on December 15, 2015. Though his term ended on December 15, 2018, he was not able to leave for India as his legal documents were not ready.
The Indian national was released from Mardan jail on Tuesday and was shifted to Islamabad for his onward journey to India, state-run Radio Pakistan reported.
Ansari was a software engineer by profession. In reply to a habeas corpus petition filed by his mother after he went missing, the high court was informed that he was in custody of the Pakistan Army and was being tried by a military court.
Pakistan claims that Ansari was an "Indian spy who had illegally entered Pakistan and was involved in anti-state crimes and forging documents."
A two-judge Peshawar High Court bench, comprising Justice Roohul Amin and Justice Qalandar Ali Khan, on Thursday heard an appeal filed by Ansari through his lawyer Qazi Muhammad Anwar.