The Supreme Court of Nepal says the government must free 21 political activists if it cannot justify their detention within 72 hours.
There have been mass arrests in Kathmandu
They were held during ongoing demonstrations against the king and for the reinstatement of parliament.
For many days, the authorities have been carrying out mass arrests of opposition activists, observers such as journalists, and even some bystanders.
Most have been released after several hours in very basic conditions.
But some have remained incarcerated for six days or more, including 21 prominent figures of the leftist party Jana Morcha, or People's Front.
'Denied legal access'
The government said they were being held under the public security act, which relates to threats to national security and allows for 90 days detention without trial.
But a Supreme Court bench has now placed this open to question. It has ruled that if the authorities cannot give a good reason for holding them by the time of another hearing on Thursday, they will have to be released.
The lawyer for the 21 told the BBC they had been denied access to their families and to legal and medical help.
He said that at least 32 more people from bigger opposition parties were also being held, and cases on their behalf were about to be filed.
Protests have been going on throughout April
The government says its ban on these rallies is necessary because they are being infiltrated by Nepal's Maoist rebels.
The opposition denies this. Although the Jana Morcha has some ideological sympathy with the guerrillas, it does not support their armed struggle.
In any case, say lawyers, holding anyone for more than 24 hours with no access to the courts is illegal.
Several hundred journalists were arrested and later released on Friday and Saturday while trying to cover the current demonstrations.
Two were badly beaten on the Friday, and on both days the police baton charged the journalists.
The Home Minister later said he regretted the injuries.
Not surprisingly, there has been outrage in the papers.
One article today said the country's vibrant press was being "abused and intimidated."
At the same time, the Federation of Nepalese Journalists has issued a sombre report saying that since November 2001, 12 journalists have been deliberately killed and ten have simply disappeared at the hands of either the government or Maoist guerrillas.