Gravity constantly pulls the star's mass inward, tending to collapse it. Nuclear fusion reactions in the core, primarily converting hydrogen to helium, release enormous amounts of energy in the form of photons (radiation) and particles. This energy creates a strong outward pressure (radiation pressure and thermal pressure) that counteracts gravity. A star remains stable, maintaining a relatively constant size, when these two opposing forces are in equilibrium, known as hydrostatic equilibrium.