The immune system plays an important role in protecting the body from infection and disease. However, sometimes the immune system can malfunction and cause problems. There are three main types of immune system disorders: allergies, autoimmune diseases, and immunodeficiencies. Allergies occur when the immune system overreacts to harmless antigens. Autoimmune diseases occur when the immune system mistakenly attacks the body's own tissues. Immunodeficiencies occur when the immune system is underactive and fails to protect against infection.