Pakistan on Monday released Indian prisoner Hamid Nihal Ansari, whose three-year jail term ended on Saturday, days after a top court gave one month deadline to the government to complete formalities to deport him.

Ansari, a 33-year-old Mumbai resident, was lodged in the Peshawar Central Jail after being sentenced by a military court to three years’ imprisonment for possessing a fake Pakistani identity card on December 15, 2015.

Foreign Office Spokesperson Mohammad Faisal claimed that Ansari was an “Indian spy who had illegally entered Pakistan.”

Ansari, who was “involved in anti-state crimes and forging documents, is being released upon completion of his sentence and is being repatriated to India,” the spokesperson said.

He was arrested in Pakistan in 2012 for illegally entering the country from Afghanistan, reportedly to meet a girl he had befriended online.

On November 12, 2012, Ansari crossed over from Afghanistan border in Jalalabad to Peshawar in Pakistan where he was nabbed by Pakistan intelligence.

Later, a military court sentenced him to three years in jail.

Despite his three-year jail term having ended, he was kept in prison.

His jail term ended on December 15 but he was not able to leave for India as his legal documents were not ready.

On Thursday, the Peshawar High Court granted the federal government a month deadline to complete his repatriation process.

On Monday, the External Affairs Ministry said that it has received a note from Pakistan that they would be releasing Ansari on Tuesday.

“It’s a matter of great relief, especially for family members, that 6 yrs of incarceration is coming to an end,” Ministry of External Affairs spokesperson Raveesh Kumar tweeted.

“We would like Pakistan to take action to also end misery of other Indian nationals and fishermen, whose nationality has been confirmed and who have completed their sentences, but continue to languish in Pakistan jails. We hope Pakistan would respond and organise an early visit of Joint Judicial Committee so that issues of prisoners can be dealt with in a humanitarian and timely manner,” Kumar added.

(With agency inputs)