THE HAGUE, Netherlands -- Ivory Coast's ex-president and a former youth minister were released from International Criminal Court custody Friday, more than two weeks after they were acquitted of involvement in deadly violence that erupted after their country's 2010 election.

Judge Chile Eboe-Osuji said that former President Laurent Gbagbo and Charles Ble Goude should be freed under conditions intended "to protect the integrity of the process." Prosecutors are expected to appeal their acquittals.

Gbagbo, who smiled broadly and waved to supporters in the court's gallery after the ruling, was released Friday evening along with Ble Goude. They were taken to an undisclosed location.

Eboe-Osuji instructed court officials to identify a country willing to accept Gbagbo and Ble Goude and to look into "interim measures" that could be taken in the meantime.

Among the conditions imposed, the men must pledge to return to court if they are told to, turn in their passports and not leave the country that agrees to house them, report weekly to police or the court and not contact witnesses or talk to the press about their case.

Gbagbo had been in custody at the court since November 2011. Ble Goude was jailed nearly five years ago.

Jubilant supporters danced and chanted "Released!" in French outside the court.

"We are very happy for Mr. Ble Goude and his family that he's finally released," his lawyer Geert-Jan Knoops told reporters at the court. He said Ble Goude likely would be released Friday evening, but it was not clear where or when.

Prosecution lawyers had urged judges to release the men only with conditions to ensure they return to the court for their appeals phase. Defense lawyers had urged their immediate, unconditional release.

Gbagbo's lawyer, Emmanuel Altit, told judges: "His innocence has been recognized by the judges and it is impossible to limit the freedom of an innocent person."

Trial judges at first ordered the immediate release of Gbagbo and Ble Goude after their Jan. 15 acquittals, but they have remained jailed amid wrangling over whether judges should impose conditions on their freedom or even keep them in detention if it proved impossible to release them with conditions.

That did not stop supporters in Ivory Coast hailing Gbagbo as "the messiah," with some mentioning a possible presidential run in 2020. However, Gbagbo may not feel safe to return to his home country just yet.

He still faces an international arrest warrant issued against him by Ivory Coast's government after being convicted in absentia last year for misappropriating funds from the West African Central Bank. He faces a possible 20-year prison sentence.

In August, Ivory Coast President Alassane Ouattara, who defeated Gbagbo in the disputed vote in 2010, granted a general amnesty to 800 people, including Gbagbo's wife, Simone, for their roles in the violence that left more than 3,000 people dead. The amnesty, however, did not specify whether it applied to the former president.

The acquittals of Gbagbo and Ble Goude were the latest setback for the international court.

The case against Kenyan President Uhuru Kenyatta, who also was accused of involvement — before he became president — in postelection violence in his country, collapsed in December 2014. Last year a former Congolese vice president, Jean-Pierre Bemba, was acquitted on appeal of crimes allegedly committed by his militia in neighboring Central African Republic.