Justice Hakim Imtiyaz in an order issued on Tuesday quashed Geelani's detention under the PSA, which was slapped on him on July 18 while he was undergoing treatment at Soura Medical Institute, and directed the authorities to release him.
Geelani has been under detention since June 7.
One of the charges levelled against him in the PSA was that he spearheaded the agitation against the rape and murder of Asiya (17) and her sister-in-law Neelofer (22) in Shopian on May 30.
Since his detention, 77-year-old Geelani has been lodged in a forest hut in Cheshmashahi area of Srinagar which has been converted into a sub-jail.
The ailing Hurriyat leader has also sought bail in five old cases registered against him in different police stations in Srinagar.
Meanwhile, Justice Hakim Imtiyaz reserved his judgment in the petition challenging the detention of another Hurriyat leader and close associate of Geelani, Ghulam Nabi Sumji, also under the PSA.
Image: Hurriyat Conference Chairman Syed Ali Shah Geelani
Breakaway Hurriyat leader Geelani under house arrest
JK: Separatist leader Geelani again under house arrest
Top separatist leaders released in Kashmir
Geelani gives statement to Delhi police
Ghosal crashes out of US Open squash