A protostar is a very young star that is still gathering mass from its parent molecular cloud. It is the earliest phase in the process of stellar evolution. For a low-mass star, it lasts about 500,000 years. The phase begins when a molecular cloud fragment first collapses under the force of self-gravity and an opaque, pressure-supported core forms inside the collapsing fragment. It ends when the infalling gas is depleted, leaving a pre-main-sequence star, which contracts to later become a main-sequence star at the onset of hydrogen fusion producing helium.