A star is formed from a nebulae, which is a cloud of dust and gas. The dust and gas particles are drawn together by the gravitational attraction between them. As the nebulae contracts, the dust and gas particles lose gravitational potential energy and gain kinetic energy, and a hot, dense region forms. This hot, dense region (known as a protostar) continues to attract more dust and gas particles; thus, it gains more mass, gets hotter and gets denser. Hydrogen nuclei at the core of the protostar will eventually have enough kinetic energy to overcome the electrostatic repulsion between them, and the hydrogen nuclei fuse together to produce helium nuclei. The fusion of the hydrogen nuclei releases energy in the form of electromagnetic radiation. Now, the inward gravitational is equal and opposite to the outward radiation pressure produced by the fusion of the hydrogen nuclei. Thus, a stable star is formed.