The Venezuelan opposition leader, Leopoldo López, was transferred to house arrest Saturday after spending more than three years in a military prison.

The supreme court said in a statement that it had granted López the “humanitarian measures” for health reasons and “serious signs of irregularities” in the handling of the case that it did not specify.

Outside López’s house in the capital, Caracas, a few dozen supporters arrived carrying Venezuelan flags to celebrate along with journalists looking for information about whether the transfer may have been part of a larger deal between the opposition and President Nicolás Maduro’s government.

The opposition has been demanding the release of dozens of activists it considers political prisoners, the most prominent being López, in order to initiate talks aimed at resolving a political crisis that has left more than 90 people dead and hundreds injured.

Quick Guide What's behind the Venezuelan crisis? Show Behind the crisis A cratering economy and acute shortages of medicine and food, coupled with rising anger at increasingly authoritarian government have contributed to the crisis. The IMF has predicted that unemployment will surpass 25% this year, as the country suffers a third year of recession. A cratering economy and acute shortages of medicine and food, coupled with rising anger at increasingly authoritarian government have contributed to the crisis. The IMF has predicted that unemployment will surpass 25% this year, as the country suffers a third year of recession. Political turmoil The president Nicolas Maduro won a general election in 2013, on a platform of continuing his predecessor Hugo Chávez's socialist policies of using the country's oil riches to reduce inequality and lift people out of poverty, but falling oil prices have forced the government to curtail social programmes. The president Nicolas Maduro won a general election in 2013, on a platform of continuing his predecessor Hugo Chávez's socialist policies of using the country's oil riches to reduce inequality and lift people out of poverty, but falling oil prices have forced the government to curtail social programmes. Recent protests Recent protest have been sparked by a court decision – later overturned – to strip the opposition-controlled national assembly of powers, and a 15-year ban from public office imposed on opposition leader Henrique Capriles. Recent protest have been sparked by a court decision – later overturned – to strip the opposition-controlled national assembly of powers, and a 15-year ban from public office imposed on opposition leader Henrique Capriles.

“We spoke for like 40 minutes. He’s hugging his children, he’s with his wife ... I’m sure they are celebrating,” López’s father, who shares his son’s name, said from exile in Spain. He said in recent days López 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.

López, 46, 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.

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.

The Spanish prime minister, Mariano Rajoy, broke the news of López’s pre-dawn transfer in a message posted on Twitter. His predecessor, José Luiz Rodriguez 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. He was in Caracas as recently as last week.

The former Colombian president Ernesto Samper, who had been working with Zapatero on some sort of humanitarian release for Lopez, praised the “positive gesture” by the government, predicting it would open a space for dialogue across Venezuela’s bitter political divide so that in the coming months there could be transparent, democratic elections.

Supporters of Leopoldo López gather outside his house in Caracas, after he was released from prison and placed under house arrest. Photograph: Juan Barreto/AFP/Getty Images

There has been much speculation about López’s health since several people, including the Florida senator Marco Rubio, reported in early May that he had been rushed to a hospital in very serious condition. The report was later denied by the government, which released video of López saying he was alive and well.

But more recently, supporters have stepped up complaints that López was being tortured and punished for supporting the street protests against Maduro – claims that the government has denied. López’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.

López’s lawyer in Spain, Javier Cremades, said the terms of López’s release meant he would be allowed to serve out his sentence at home and could not leave.

“It is a gesture of weakness of the Maduro regime and of the opposition’s strength,” Cremades said. “It is a step forward, and very positive news.”

The lawmaker Gaby Arellano, of López’s Popular Will party, said his release represented “the end of the dictatorship”.

Foreign governments and human rights groups have criticized López’s detention as politically motivated. A Venezuelan prosecutor on the case who later sought asylum in the US has said he was ordered by the government to arrest López despite a lack of evidence.

Lilian Tintori, López’s wife, has campaigned in Venezuela and abroad to try to win freedom for her husband.

In February, she met with Donald Trump in the White House. Trump tweeted a photo of the Oval Office encounter and called for López to be released “immediately”.

“It gives us great pleasure that Leopoldo López is at his home with his family!” said Henrique Capriles, another opposition leader, via Twitter. “He must be given his full freedom, like all the political prisoners!”