The opposition has been demanding the release of dozens of activists it consider political prisoners, the most prominent being Lopez

Receive the latest national-international updates in your inbox

File Photo—Supporters of Venezuela's jailed opposition leader Leopoldo Lopez hold posters of him during a concentration to demand the release of Lopez and other jailed opposition leaders, during the second anniversary of his imprisonment, in Caracas, Venezuela, Saturday, Feb. 20, 2016.

Opposition leader Leopoldo Lopez was released from prison and placed under house arrest Saturday after more than three years in military lockup, a shock reversal that fueled hopes for a broader amnesty for dozens of jailed activists as the country slides ever deeper into political turmoil.

Venezuela's government-stacked Supreme Court said in a statement that it had granted Lopez the "humanitarian measures" for health reasons and "serious signs of irregularities" in the handling of the case that it did not specify.

A euphoric Lopez briefly greeted a few dozen supporters gathered outside his home in Caracas in the afternoon. Climbing atop a wall dressed in a white shirt, he clutched and kissed a Venezuelan flag and raised his right fist in a show of defiance.

Lopez vowed that he's prepared to return to jail rather than give up his fight to remove President Nicolas Maduro.

"This is a step in the march toward freedom," Lopez said in a statement read by close ally and lawmaker Freddy Guevara. "I carry no resentment, nor will I give up my beliefs. My position against this regime is firm as are my convictions to fight for a real peace, coexistence, change and freedom."

As his backers celebrated, relatives of dozens of other jailed activists gathered at a Caracas jail in hopes that their loved ones might be released too in the coming hours.

Speculation that Lopez's transfer may have been part of a larger deal was sparked in part by a government truth commission statement saying that as part of its work to defuse tensions, it had asked the judicial system to evaluate applying "alternative formulas" for those imprisoned for violent acts.

The opposition has been demanding the release of dozens of activists it consider political prisoners in order to initiate talks aimed at resolving a political crisis that has left more than 90 people dead and hundreds injured. But Lopez, the most prominent and defiant of those behind bars, was seen as the last person likely to leave jail in the event of any government concessions.

The 46-year-old former Caracas-area mayor was sentenced in 2015 to nearly 14 years in prison for inciting violence during anti-government protests in which three people died and dozens were wounded.

"We spoke for like 40 minutes. He's hugging his children, he's with his wife. .... I'm sure they are celebrating," Lopez's father, who shares his son's name, said from exile in Spain. He said in recent days Lopez had been isolated in his prison cell without food and attributed his son's transfer to the considerable international pressure on Maduro's government.

"He told me himself recently: Dad, it's always darkest right before the break of dawn," he added.

Venezuela has been rocked by months of near-daily protests again this year, fueled by widespread discontent over shortages of basic goods, galloping inflation and allegations that Maduro is undermining democracy in the country.

Spanish Prime Minister Mariano Rajoy said he had been informed of the news of Lopez's transfer by his predecessor, Jose Luiz Rodriguez Zapatero, who he said played a role in the breakthrough. Zapatero has been traveling back and forth to Venezuela for months trying to broker a deal on jailed opposition leaders and jumpstart a dialogue between the government and opposition.

Zapatero's efforts were also acknowledged in the statement by the truth commission.

Colombian former President Ernesto Samper, who had been working with Zapatero, called it a "positive gesture" by the government and predicted it would open a space for dialogue across Venezuela's bitter political divide.

The Supreme Court statement pointing to possible "irregularities" in the Lopez case surprised government supporters and foes alike because the high court has not previously shown any signs of misgivings about its rulings.

Foreign governments and human rights groups have long criticized Lopez's detention as politically motivated, and one of the prosecutors on the case who later sought asylum in the United States even said that he was ordered by the government to arrest Lopez despite a lack of evidence. The judge in the case was later sanctioned by the Obama administration.

Maduro supporters said the decision in no way exonerates Lopez or the opposition from attempts to destabilize the government.

"President Maduro has always called for peace and dialogue, something the right wing always rejected. But dialogue always produces results," Information Minister Ernesto Villegas said on Twitter. "Hopefully in his new conditions Leopoldo Lopez will call on his allies and followers to reflect and abandon violence."

In early May there were reports, including from Florida Sen. Marco Rubio, that Lopez had been rushed to a hospital in very serious condition. The government later denied that and released video of Lopez saying he was well.

But more recently supporters have stepped up complaints that Lopez was being tortured and punished for supporting the street protests against Maduro — claims that the government has denied. Lopez's party said he had not been allowed to see his lawyers for 90 days and had been in solitary confinement for the last 32 days.

Lopez's lawyer in Spain, Javier Cremades, said the terms of Lopez's pre-dawn transfer mean he will be allowed to serve out his sentence at home and cannot leave.

Lilian Tintori, Lopez's wife, has campaigned in Venezuela and abroad to try to win freedom for her husband and met with President Donald Trump in February. Afterward Trump tweeted a photo of the Oval Office encounter and called for Lopez to be released "immediately."

"This is a major capitulation by Venezuela's government, which just days ago allowed armed thugs to assault the National Assembly and beat up opposition lawmakers," said Jose Miguel Vivanco, Americas director at Human Rights Watch. "It's a sign that the massive street protests — plus the calls by democratic leaders throughout Latin America to end the repression — are having an impact."