The J&K high court had ordered his release on Tuesday.
"Masarat was released today in the case in which the high court had quashed his detention. But he was rearrested subsequently from jail in another case," a senior Police officer said.
Justice Muzaffar Hussain Attar, while allowing Masarat's plea challenging the latest of the detention orders under Public Safety Act, held his detention illegal on several grounds.
Masarat had been booked under PSA several times since April 2015 and the latest order in the series was issued by District Magistrate Baramulla.
"...(the) order of detention...passed by the (deputy commissioner Baramulla) is quashed with a further direction to the (government) to release (Masrat) Alam forthwith from preventive custody," the court had said in its order on Tuesday.
According to the order, Masarat was accused of making the ongoing agitation "successful" from inside the jail.
While passing Masarat's release order, the court had said, "Democratic society not only swears but lives by democratic values and principles. Even in the face of extreme provocations, the laws of the land are to be implemented.
"Laws possess unique quality, in as much as, they, even at times, protect those who break them. Thus, they prove to be better than many human beings."
Masarat was released after four-and-half years of detention soon after the PDP-BJP government took charge in March last year.
However, he was re-arrested on April 17, 2015 and detained under the PSA for alleged anti-national activities during a rally to welcome Geelani home from Delhi.