Any of the organs that are involved in the excretion of nitrogenous waste and osmoregulation in insects and other terrestrial arthropods, including arachnids, and in centipedes. They lie in the haemocoel, and the primary urine is formed by secretion into the lumen of the Malpighian tubules, principally by the active transport of potassium ions (K+) across the tubule walls. The tubules also selectively extract from the haemolymph uric acid, which—together with water and salts—flows from the tubules into the hindgut to be excreted in the faeces. Some reabsorption of water and salts can occur in the tubules, but most occurs in the hindgut, thereby maintaining the ionic concentration of the haemolymph. See also cryptonephridial system.