Angola's Supreme Court has ordered the release of 18 youths jailed last month for protesting against President Jose Eduardo dos Santos's 32-year rule.
An emergency court convicted the youths for public order offences.
The Supreme Court overturned the ruling, saying there was insufficient evidence against them.
Tension has been rising in Angola ahead of elections due next year, with opposition groups calling for Mr Dos Santos to step down.
He is Africa's longest-serving ruler, along with Equatorial Guinea's Teodoro Obiang.
The BBC's Louise Redvers in the capital, Luanda, says the Supreme Court's decision has been widely welcomed as the initial convictions were seen as draconian.
The protesters had been jailed for between 45 and 90 days after taking part in a demonstration in Luanda early last month.
A series of anti-government protests, inspired by the downfall of North African regimes, have taken place in the city in recent weeks.
The protesters, mostly young people, have no fixed political affiliation.
Mr Dos Santos has not yet said whether he intends to run for the presidency in elections planned for next year.