Ansari, a young engineer from Mumbai, went missing in 2012 after he was arrested by Pakistani authorities for allegedly entering Northwest Pakistan illegally to meet a woman he had befriended and fallen in love with, online.
The engineer's whereabouts were largely unknown for some time till a young Pakistani journalist reported his case.
Only then did it emerge that he was in Pakistan's custody.
A military court tried Ansari, and then jailed him
In what appears to be a case of Veer-Zaara gone horribly wrong, Ansari was subsequently kept in detention for three years - from 2012 to 2015.
During this time, Ansari was tried by an opaque military court which handed him a three-year sentence in 2015, without taking into account the three-years he had already spent in Pakistani confinement.
Pakistan still maintains that Ansari is a spy.
Pakistan had turned down 96 consular access requests by India
Given Pakistan's conviction, Indian authorities had a tough time trying to get Ansari back, despite officials relentlessly pursuing his release.
However, an adamant Pakistan had denied 96 requests by India for consular access to Ansari.
Over the past six years, the only status update given on Ansari was a "very brief" telephone conversation that Pakistan allowed between the jailed engineer and his mother.
Ansari's release: Goodwill from Pakistan or pressure from India?
While Pakistan seems to have released Ansari as another goodwill gesture on the back of opening the Kartarpur corridor, it wasn't without significant pushes from India's side.
On December 11, India had issued a strongly-worded note verbale to Pakistan, demanding that Ansari be released immediately upon the completion of his sentence.
Although Ansari's term ended on December 15, his documents weren't ready for immediate return.
No official communication was made about Ansari's trial
"He [Ansari] has been languishing in Pakistani jail/s for about six years now and no consideration was shown towards his pre-trial custody period of more than three years," said India, adding that there had been no "official communication with regards to charges levelled against him."
Pakistan reportedly has a habit of retaining prisoners beyond sentences
In the note verbale, India also mentioned that it had identified 11 other Indians who had already completed their sentences a year back, but still had not been released by Islamabad.
Unfortunately, it's not uncommon for Pakistan to detain Indians beyond their jail terms, and Islamabad has done so on multiple occasions.
Currently, over 400 Indian fishermen remain in Pakistan custody, awaiting release.