Pernicious anemia is a type of megaloblastic anemia that results from a deficiency of vitamin B12, also known as cobalamin. This condition is often due to an autoimmune response against the gastric parietal cells, which are responsible for the secretion of intrinsic factor, a protein essential for vitamin B12 absorption in the small intestine.