An Egyptian arrested at the age of 18 while on his way home from a peaceful protest was ordered to be released pending bail after more than two years in prison.

Mahmoud Mohamed Hussein's release, ordered by an Egyptian court, was confirmed by his brother Tito on Twitter on Tuesday.

"My brother has been released on bail," Tito Tarek tweeted, adding the bail was set at 1,000 Egyptian pounds ($113).

The US-based Robert F Kennedy Human Rights group, which had acted on behalf of Hussein, also confirmed the release order, describing the moment as a "huge victory".

Peter Greste returns to Al Jazeera! #FreeAJStaff

"[But] he is not yet physically free," Wade H McMullen Jr, managing attorney at the rights group, told Al Jazeera.

"The prosecution did not show up to [Tuesday's] hearing. So we will have to wait to see if the prosecution decides to appeal his release."

He added there were serious concerns about the state of Hussein's health.

"While being held at the Tora Investigations Prison, Mahmoud lost a significant amount of weight and his health has seriously deteriorated," he said, before adding that doctors have recommended that Hussein, now 20, receives urgent medical care.

'A nation without torture' T-shirt

Hussein was arrested on January 25, 2014, with police accusing him of illegal protesting, getting paid to protest, possessing Molotov cocktails, and belonging to a "terrorist" organisation.

He was walking home from a peaceful demonstration to commemorate the third anniversary of the January 25, 2011 revolution that ousted long-time president Hosni Mubarak.

He was detained while wearing a protest scarf and a T-shirt that read: "A nation without torture" at the el-Marg checkpoint in Cairo.

Since his detention, Hussein faced near-automatic detention renewals, more than 20 of which were decided in his absence.

Amnesty International cautiously welcomed news of his release.

"While the court’s decision comes as a huge relief for Mahmoud Hussein and his family, it should not overshadow the outrageous injustice he has suffered," said Magdalena Mughrabi from the Middle East and North Africa Programme.

"He is a prisoner of conscience who should never have been jailed in the first place. The Egyptian authorities must now drop all charges against him."

Follow Anealla Safdar on Twitter: @anealla