A U.S. judge on Wednesday ordered the military to release one of its first Guantanamo Bay detainees, a 21-year-old man who has been detained and accused of being a terrorist since he was 14.

Mohammed el Gharani, who is of Chadian nationality but had lived in Saudi Arabia, should be released from the U.S. prison in Cuba "forthwith," U.S. District Judge Richard Leon said in a ruling from the bench.

The military had accused el Gharani of being part of Al Qaeda, working for the Taliban and fighting American forces in Afghanistan. However, Leon said those accusations were based on testimony from other Guantanamo Bay detainees, which he found unreliable.

El Gharani listened to the ruling by telephone from Cuba but did not react.

He could be on his way home to his family in a few weeks, lawyer Zackary Katznelson said. "Judge Leon did justice today."

The government can appeal Leon's decision.

"We're disappointed by the ruling and will consider our options," Justice Department spokesman Dean Boyd said.