A federal judge has ordered the U.S. Environmental Protection Agency to begin regulating the discharge of ballast water from ships to prevent invasive species from harming local ecosystems.

U.S. District Judge Susan Illston's order follows her ruling last year that the EPA could not exempt shipping companies from having to obtain permits to dump ballast water, which is held at the bottom of ships to keep them stable.

"The EPA regulation is plainly contrary to the congressional intent embodied in the [Clean Water Act]," Illston wrote in the ruling issued Monday in San Francisco.

EPA officials could not be reached for comment Wednesday.

Illston ordered the EPA to take action to restrict the discharge of invasive species in ballast water and comply with the Clean Water Act by Sept. 30, 2008.

In 1999, environmental groups petitioned the EPA to repeal the ballast-water exemption. They claimed the Clean Water Act prohibits the discharge of pollutants, including biological materials — such as invasive species — into U.S. waters without a permit.

When the EPA denied the petition, the conservation groups filed a lawsuit in federal court in San Francisco in 2003. They were later joined by six Great Lakes states.

Invasive species are known to cause significant economic and environmental damage. Marine species such as mollusks often are inadvertently transported in the ballast water of ships and discharged at ports far from their origins.

On Monday, Gov. Arnold Schwarzenegger signed legislation that requires the California State Lands Commission to adopt regulations for ballast water discharges from cargo ships, cruise liners and other vessels by January 2008.