Lightning is an abrupt electrostatic discharge that occurs between clouds or from clouds to the earth. It is accompanied by a flash. Charges build up in clouds during storms and separate, with negative charges near the ground and positive charges higher up. When enough charge builds up, electrons move toward the positive charges, ionizing the air and allowing discharge along a path of least resistance in a zigzag pattern. Upward and downward leaders form until they meet, causing a stroke and releasing a large amount of heat and producing the flash and thunder. Lightning arrestors safely guide the current from a strike to ground to dissipate the energy.