Prison service found to have failed in treatment of foreign prisoners