The new law will make California the second state in the country to regulate the water that ships take on and discharge to maintain balance.

Ballast water is typically discharged when ships are docked at ports, but the water often carries nonnative clams, crabs and other species that have harmed waterways like the San Francisco Bay and the Sacramento-San Joaquin River Delta.

SB497, by Sen. Joseph Simitian, D-Palo Alto, was signed by Schwarzenegger at a Long Beach conference on ocean protection. The new law requires the state Lands Commission to adapt ballast water performance standards for both small and large vessels and calls for ballast water to be free of invasive species by 2020.

About 21 billion gallons of ballast water are discharged into U.S. waters every year, according to figures released by Simitian's office, and about 7,000 species of marine life are transported in ballast water throughout the world each day.

About 250 nonnative species have been detected in San Francisco Bay, according to Simitian.

He said invasive species have a significant impact in "our coastal environment and economy, as well as the public's health and safety.