The collapsing gas heats up and becomes a protostar. A protostar stops collapsing when nuclear fusion begins in its center.
Stars start out as dense cores in molecular clouds.
To start their collapse, we must first compress them with a shock wave traveling through the interstellar medium. Click on the image to see an enlarged, higher-resolution version. After the initial trigger provided by the passing shock wave, the gas is in free fall. The velocity of the infalling gas becomes greater and greater, and the dense core becomes denser and denser. When the gas reaches the center, it collides with the gas falling inward from the other direction.