FLAGSTAFF, Ariz. (AP) — A dispute between two major California water agencies is threatening to derail a hard-won agreement designed to protect a river that serves 40 million people in the U.S. West.

The Imperial Irrigation District, the largest single recipient of Colorado River water, on Tuesday sued a Los Angeles water utility that agreed to contribute all of California’s water to a key reservoir under a multistate drought contingency plan.

The action came the same day President Donald Trump approved federal legislation to implement the plan, which Arizona, California, Colorado, Nevada, New Mexico, Utah and Wyoming spent years negotiating.

The agreement is meant to keep the country’s two largest reservoirs on the Colorado River from dropping so low they cannot deliver water or produce hydropower amid prolonged drought and climate change.

The Imperial Irrigation District said it wouldn’t join the drought plan unless it secured $200 million in federal funding to address health and environmental hazards at the Salton Sea, a massive, briny lake southeast of Los Angeles.

The Metropolitan Water District, which serves Los Angeles, essentially wrote Imperial out of the drought plan to prevent delays in implementing it. It said it would contribute all of California’s water to Lake Mead, which could top 2 million acre-feet through 2026 when the drought plan expires. An acre-foot is enough water to serve one to two average households a year.

Imperial’s lawsuit claims the Metropolitan Water District sidestepped an environmental law.

“Where the water supply would come from and what environmental impacts could result from Metropolitan’s need to acquire such water to fill this sizable hole in its water supply are entirely unknown,” Imperial wrote in court documents filed in Los Angeles County Superior Court.

A California law requires state and local agencies to identify any potential environmental effects of their actions and address them if possible. Imperial is asking the court to force Metropolitan to comply with that law, which could delay the larger drought plan from being implemented.

Metropolitan has said storing water in Lake Mead under the drought plan doesn’t require review under the California Environmental Quality Act because any changes to its facilities would be minor.

“We are disappointed that the Imperial Irrigation District is using litigation as a tool to block implementation of the drought contingency plan,” Metropolitan general manager Jeff Kightlinger said in a statement Wednesday. “Parties on the Colorado River need to collaborate during this time of crisis, not litigate.”

Imperial took the stance in December that the drought plan would be exempt from the environmental law. District spokesman Robert Schettler said Wednesday that came before Metropolitan strayed from a version that Imperial approved with stipulations.

The seven states and U.S. Bureau of Reclamation have said the drought plan won’t affect the Salton Sea, but the Imperial Irrigation District isn’t convinced.

“The logic in going forward without IID was that the DCP (drought contingency plan) couldn’t wait for the Salton Sea,” general manager Henry Martinez said Wednesday. “This legal challenge is going to put that logic to the test, and the focus will now be where it should have been all along, the Salton Sea.”