Fifteen of 47 Hong Kong pro-democracy activists charged with subversion have been granted bail after a marathon hearing, but the entire group remains in custody pending an appeal.
They were charged under a new security law that critics say is being used by Beijing to crush dissent in the city.
China passed the law last year, saying it was required to bring stability.
All 47 activists will remain in custody while the department of justice appeals against the bail ruling for the 15.
The activists are facing up to life in prison for the charge of conspiring to commit subversion, in the most sweeping application yet of the new national security law.
They include veterans of the protest movement like academic Benny Tai and politician Leung Kwok-hung, as well as younger protesters like Gwyneth Ho, Sam Cheung and Lester Shum.
The bail hearing for the 47 defendants began on Monday and only wrapped up on Thursday evening.
Police officers were deployed throughout to control the crowds as pro-democracy supporters queued for seats at the court.
A gruelling few days in court
By Grace Tsoi, BBC News, Hong Kong
Many people were in tears after finding out all 47 activists have to be remanded in custody, including the 15 who were granted bail by the magistrate.
Because of the large number of defendants, only they and their lawyers, plus the prosecutors, were present in the courtroom. Others, including family members, could only watch the live feeds in other courtrooms.
To the families of some defendants, the failure to get bail came as no surprise. There is a much higher threshold for bail under the National Security Law.
The defendants have had four uneasy days. Monday’s session lasted for more than 13 hours. The judge only adjourned the hearing after one defendant fainted. Several other defendants were subsequently taken to hospital.
They had not even been given time to shower in the three days since they reported to police stations on Sunday. The latest hearing was delayed to allow this, after the defence raised the issue of personal hygiene.
The defendants are accused of running an unofficial “primary” election last June to pick opposition candidates for 2020 legislative elections, which the government then postponed.
Chinese and Hong Kong officials have claimed the primary was an attempt to overthrow the government.
About 100 people have so far been arrested under the security law, including prominent China critic and media tycoon Jimmy Lai, who was denied bail and is in detention awaiting trial.
The first trial under the new law is expected to be that of Tong Ying-kit, who is accused of riding a motorcycle into police officers last July. He appeared in court in November to enter a not guilty plea. He is expected to be tried by three judges rather than a jury.
Amnesty International described the January raids that detained the 55 as “the starkest demonstration yet of how the National Security Law has been weaponised to punish anyone who dares to challenge the establishment”.
UK Foreign Secretary Dominic Raab said on Monday that the decision to bring charges against the 47 was a “deeply disturbing” step that violated the joint declaration that Beijing had reached with Britain before the former colony was handed back to China.
What is the National Security Law?
Hong Kong’s sovereignty returned to China in 1997 but under the “one country, two systems” principle. The principle was supposed to guarantee certain freedoms for the territory – including freedom of assembly and speech, an independent judiciary and some democratic rights, which mainland China does not have.
But the National Security Law has reduced Hong Kong’s autonomy and made it easier to punish demonstrators. The legislation introduced new crimes, including penalties of up to life in prison.
Anyone found to have conspired with foreigners to provoke “hatred” of the Chinese government or the Hong Kong authorities may have committed a crime.
Trials can be held in secret and without a jury, and cases can be taken over by the mainland authorities. Mainland security personnel can legally operate in Hong Kong with impunity. After the law was introduced, a number of pro-democracy groups disbanded out of fears for their safety.