An action potential is a rapid depolarization and repolarization of the membrane caused by opening of voltage-gated sodium and potassium channels. The depolarization phase results from sodium influx, while potassium efflux causes repolarization back to the resting potential.