Two lawsuits between two major California water agencies have been settled. The said lawsuits once threatened to derail a multi-state agreement to protect a river that serves millions of people in the US West amid a gripping drought.

The Imperial Irrigation District, the largest single recipient of Colorado River water, had twice sued the Metropolitan Water District in the past two years. Both the agencies announced on Monday that a settlement has been reached that resolves both the lawsuits.

Imperial can now store water in Lake Mead on the Arizona-Nevada border under Metropolitan’s account, according to the settlement. In turn, Imperial will contribute water under a regional drought contingency plan if California is called on to help stave off further water cuts, the Associated Press reported.

A spokesperson for the Imperial Irrigation District said that the agency hopes that its partners in California and across the Colorado River basin recognize the opportunities to work together.

“But also, to make sure those environmental challenges like the ones we face every day here at the Salton Sea will be a part of the discussion to make sure it’s being addressed, and IID’s concerns are not ignored,” the spokesperson added, according to the Associated Press.

The Colorado River is a source of water for 40 million people in Colorado, Wyoming, Utah, New Mexico, Arizona, California, Nevada, and Mexico.

Imperial sued Metropolitan, alleging the water agency that serves Los Angeles violated a state environmental law when it sidestepped Imperial in the drought contingency talks. The Los Angeles County Superior Court ruled against Imperial, which appealed to the California Court of Appeals earlier this year.

Another complaint filed in 2020 accused Metropolitan of breaching a contract related to storing Colorado River water in Lake Mead. Metropolitan denied the allegations. A trial was scheduled for April 2022.

Those cases became moot with the agreement signed last week that also outlines regular talks between the agencies to respond to drought, according to court documents. Metropolitan said it will support Imperial’s efforts to restore the Salton Sea and to secure more funding for the massive, briny lake southeast of Los Angeles.

Imperial has rights to more than one-third of the water allocated to the three states in the river’s lower basin and Mexico.

Seven Western states finalized the drought plan in 2019 to keep the water levels at Lake Mead and Lake Powell — upstream on the Arizona-Utah border — from dropping substantially. Still, the US Bureau of Reclamation declared the first-ever shortage in water supply for 2022 that will impact Arizona, Nevada, and Mexico.