Why were immigration inspection facilities like Ellis Island built?

Why were immigration inspection facilities like Ellis Island built?