In organic and inorganic chemistry, nucleophilic substitution is a fundamental class of reactions in which an electron rich nucleophile selectively bonds with or attacks the positive or partially positive charge of an atom or a group of atoms to replace a leaving group; the positive or partially positive atom is referred to as an electrophile.