A prominent theme in bioenergetics is the segregation of ions by membranes for energy purposes, which allows the storage of free energy in diffusion and in membrane potential. The processes of photosynthesis in plants and oxidative metabolism in eukaryotes involve such functioning of membranes. Photosynthesis on the inner membranes of chloroplasts generates a proton gradient for ATP synthesis between the thylakoid lumen and the stroma. A similar process occurs on the inner membranes of mitochondria, where the electron transport system leads to the formation of a proton gradient between the intermembrane space and the matrix. The free energy of this concentration gradient is then used to drive ATP synthesis.