A judge freed Zambian opposition leader Hakainde Hichilema on Wednesday after the state prosecutor dropped charges against him of plotting to overthrow the government.
Hichilema and five others were arrested in April and charged with treason after his convoy failed to make way for President Edgar Lungu's motorcade.
His release could help defuse tensions in the southern African country, where Lungu imposed a state of emergency in July.
"The [Director of Public Prosecutions] has decided to terminate these proceedings by virtue of her constitutional powers. Therefore, you're hereby discharged," high court judge Charles Chanda said.
Treason is an offence in Zambia that carries a minimum 15-year jail-term and, in theory, a maximum sentence of death. A person accused of treason is not allowed to post bail.
Zambia has enjoyed relative stability since its first multi-party election in 1991.
But last year's election was marked by clashes between supporters of Lungu's Patriotic Front (PF) party and Hichilema's United Party for National Development (UPND).
Hichilema, 55, said the election was rigged and he refused to recognise Lungu as the president of Zambia.
When he was arrested, Amnesty International said Hichilema and the five other accused were "victims of longstanding persecution" by authorities and faced charges designed to "harass and intimidate".
Lungu did not mince words during the election campaign, warning political rivals and activists that "if they push me against the wall, I will sacrifice democracy for peace".
In June, parliament suspended 48 UPND legislators for boycotting a Lungu address three months earlier.
And last month, Lungu invoked a state of emergency, increasing police powers of arrest and detention after a series of arson attacks blamed on opposition parties.
The government has also increased pressure on media outlets that support the opposition, eroding Zambia's reputation as a stable democracy.
Source: News agencies