Gamal and Alaa Mubarak
Gamal and Alaa MubarakReuters

An Egyptian court on Thursday ordered the release from detention of former president Hosni Mubarak's two sons, Alaa and Gamal, reported The Associated Press.

The decision overturned a ruling by another court whose judge surprisingly told police to arrest them and send them to prison.

The judge in the September 15 hearing ordered the detention of the two sons of the former president before adjourning the hearings until October 20. The surprise decision by Judge Ahmed Aboul-Fetouh followed his rejection of a technical report that apparently cleared the pair of any wrongdoing, according to AP.

Thursday's ruling to release the Mubarak sons on a bail of 100,000 pounds ($5,600) each came just hours after an appeals court accepted a motion moved by their defense lawyers to remove the judge who ordered their detention.

In their motion, the lawyers argued that the ruling was "unreasonable" given that they regularly attended hearings and their place of residence was known to authorities.

Gamal and Alaa Mubarak are accused along with three other people of failing to notify the stock market of agreements to acquire majority stakes in several banks through front companies.

The brothers along with their father were first detained two months after a popular uprising forced the senior Mubarak to step down in February 2011.

After six years in custody, Mubarak was acquitted last March and subsequently set free.

After being arrested in 2011 for a number of alleged crimes, the two sons spent time in provisional detention. They have been free for the past three years.

Alongside their father, Alaa and Gamal Mubarak were sentenced in May 2015 to three years in jail for diverting more than $11.5 million in public money to maintain presidential palaces. They were later released for time served.