Justice Achintya Malla Bujar Barua passed the judgment on Gogoi's detention and that accordingly he was entitled for immediate release if not arrested in any other case.
Gogoi was arrested on September 13 on charges of sedition and 11 days later he was booked under the NSA.
While addressing a rally in Moran town on September 12, Gogoi had said if Hindu migrants from Bangladesh were forced upon Assam people from the state would be compelled to take up arms. He was arrested the next day.
Gogoi has been leading an agitation against the government's handling of the farming crisis in Assam, the building of dams, land mafia and corruption in public life.