Immunodeficiency (or immune deficiency) is a state in which the immune system's ability to fight infectious disease is compromised or entirely absent. Immunodeficiency may also decrease cancer immunosurveillance. Most cases of immunodeficiency are acquired ("secondary") but some people are born with defects in their immune system, or primary immunodeficiency. Transplant patients take medications to suppress their immune system as an anti-rejection measure, as do some patients suffering from an over-active immune system. A person who has an immunodeficiency of any kind is said to be immunocompromised. An immunocompromised person may be particularly vulnerable to opportunistic infections, in addition to normal infections that could affect everyone.

Distinction between primary versus secondary immunodeficiencies are based on, respectively, whether the cause originates in the immune system itself or is, in turn, due to insufficiency of a supporting component of it or an external decreasing factor of it.

There are a large number of immunodeficiency syndromes that present clinical and laboratory characteristics of autoimmunity. The decreased ability of the immune system to clear infections in these patients may be responsible for causing autoimmunity through perpetual immune system activation.[8]

One example is common variable immunodeficiency (CVID) where multiple autoimmune diseases are seen, e.g. inflammatory bowel disease, autoimmune thrombocytopenia and autoimmune thyroid disease. Familial hemophagocytic lymphohistiocytosis, an autosomal recessive primary immunodeficiency, is another example. Pancytopenia, rashes, lymphadenopathy and hepatosplenomegaly are commonly seen in these patients. Presence of multiple uncleared viral infections due to lack of perforin are thought to be responsible. In addition to chronic and/or recurrent infections many autoimmune diseases including arthritis, autoimmune hemolytic anemia, scleroderma and type 1 diabetes are also seen in X-linked agammaglobulinemia (XLA). Recurrent bacterial and fungal infections and chronic inflammation of the gut and lungs are seen in chronic granulomatous disease (CGD) as well. CGD is caused by a decreased production of nicotinamide adenine dinucleotide phosphate (NADPH) oxidase by neutrophils. Hypomorphic RAG mutations are seen in patients with midline granulomatous disease; an autoimmune disorder that is commonly seen in patients with granulomatosis with polyangiitis (Wegenr’s disease) and NK/T cell lymphomas. Wiskott-Aldrich syndrome (WAS) patients also present with eczema, autoimmune manifestations, recurrent bacterial infections and lymphoma. In autoimmune polyendocrinopathy-candidiasis-ectodermal dystrophy (APECED) also autoimmunity and infections coexist: organ-specific autoimmune manifestations (e.g. hypoparathyroidism and adrenocortical failure) and chronic mucocutaneous candidiasis. Finally, IgA deficiency is also sometimes associated with the development of autoimmune and atopic phenomena.