FILE PHOTO: Swedish software developer Ola Bini (L) sits at court in Quito, Ecuador May 2, 2019. REUTERS/Daniel Tapia/File Photo

QUITO (Reuters) - An Ecuadorean judge on Thursday ordered that a Swedish citizen and personal friend of WikiLeaks founder Julian Assange be freed, two months after he was detained for alleged participation in a hacking attempt on the government.

But Ola Bini, a 36-year-old software developer who has lived in Ecuador for five years, remains under investigation in the case and will be barred from leaving the country, according to the court ruling.

Bini was detained in April at the Quito airport before boarding a flight to Japan, hours after Ecuador withdrew asylum for Assange, who had lived at its London embassy for almost seven years while facing spying charges related to WikLeaks’ 2010 publication of secret U.S. diplomatic cables.

Ecuador’s Interior Minister Maria Paula Romo had accused him of seeking to destabilize the Andean country’s government and compromising its national security. Bini has denied those allegations, but has acknowledged being close to Assange.

“His right to freedom was violated,” judge Patricio Vaca said, reading the Thursday court ruling. “We accept the habeas corpus action proposed by the Swedish citizen Ola Bini, who can be immediately freed.”

Bini worked at the Quito-based Center for Digital Autonomy, an organization focusing on cybersecurity and data privacy. His lawyer, Carlos Soria, told journalists on Thursday that he would ask “international courts” to determine any “prejudice” to the case that may have resulted from his arrest.

“We will take actions against everyone because the court has determined that his detention was arbitrary. Now they will have to pay,” Soria said. “We will demonstrate Ola Bini’s innocence.”

Assange is now under arrest in the United Kingdom, and an extradition hearing to decide whether he should be sent to the United States is scheduled for early next year.