Judge orders Iraqi man released after long detention