Hong Kong's highest court has freed pro-democracy activists Joshua Wong and Nathan Law on bail pending an appeal against their prison sentences after they were convicted of sparking massive protests in 2014.
They were imprisoned after the justice secretary had an earlier, more lenient sentence overturned, raising concerns about political interference in the courts and dealing a setback to the movement for full democracy in the Chinese-controlled city.
The decision to release Mr Wong, Hong Kong's most famous activist, and Mr Law, a disqualified legislator, came the same day China's Communist Party was ending a twice-a-decade congress in Beijing that expanded President Xi Jinping's power.
Though the events were unrelated, they highlighted the widening rift between mainland China and semi-autonomous Hong Kong.
Mr Wong, 21, and Mr Law, 24, told reporters outside the Court of Final Appeal that they were granted bail until their appeals are heard on November 7.
They said they were looking forward to having meals with their families after what Mr Law said were some "uncomfortable times" during their two months in prison.
Even though they have been bailed, they said it was unclear if their appeals would be successful and that they are prepared to go back to prison.
"There will be more occasions in the future when our group of young people will go to prison, but we will persist in keeping the faith and working together to fight for democracy," said Mr Wong, who is also awaiting sentencing for a separate contempt case.
"The government can lock up our bodies but cannot lock up our minds," he said, adding that their time in prison was a chance for them to strengthen their determination.
"The world is watching the result of the case," and what it means for rule of law and the "one country, two systems" principle that guarantees Hong Kong wide autonomy and civil liberties unseen in mainland China, Mr Law said.
Broadcaster RTHK reported that Judge Geoffrey Ma required each to post 50,000 Hong Kong dollars (£4,800) for bail, surrender their travel documents and report to police once a week.
They were originally given community service sentences that let them avoid prison after convictions for involvement in an unlawful assembly that kicked off the "Umbrella Movement" protests.
Hong Kong's justice secretary requested that the courts review those punishments, and in August, Mr Wong was given six months in prison and Mr Law received eight months.
The move sparked fears that authorities were undermining the city's independent judiciary.
Mr Wong gained fame, including a starring role in a Netflix documentary, because he was still a teenager when he helped spearhead the 2014 protests against Beijing's decision to restrict elections that brought major Hong Kong thoroughfares to a standstill for 79 days.
Mr Law, also a former protest leader, was elected to the legislature last year, becoming the city's youngest-ever legislator, but was disqualified from office after a government legal challenge.
A third student leader, Alex Chow, did not request bail in the same case.
In another development highlighting concerns about human rights in the city, the Chinese and Swedish governments confirmed the release of Gui Minhai, one of five Hong Kong booksellers believed to have been abducted and spirited to mainland China for selling gossipy titles about elite Chinese politicians to Chinese readers.
Sweden's foreign ministry said it was informed by Chinese authorities that Mr Gui, who has Swedish citizenship, had been released from Chinese detention, although Mr Gui's daughter disputed the news.
China's foreign ministry said in a brief statement that he had been released on October 17 after "serving out his prison term for which he had been sentenced for the crime of having caused a traffic accident".
It gave no information about his whereabouts or other details.
Mr Gui disappeared from his Thai vacation home in late 2015 and resurfaced in January 2016 on China's state broadcaster CCTV, where he said he returned to China to turn himself in for an old crime.