A Federal immigration judge ruled yesterday that an Egyptian man kept in solitary confinement for the last three years on the basis of secret evidence allegedly linking him to a terrorist organization should be freed from jail.