New Mexico ranks ninth in the nation for the number of immigrants lacking permanent legal status detained while awaiting court appearances.