A cargo vessel's center of gravity, and thus its stability, alters as it loads and unloads cargo.  During unloading, the center moves upward as the vessel gradually rises in the water, and so the vessel takes on ballast water to compensate (to an extent) to keep the center of gravity within acceptable safety parameters. During loading operations, the opposite process occurs and the vessel discharges ballast water as the vessel's freeboard (the distance between the vessel's deck amidships and the water level) lowers.