SALEM, Ore. (AP) – A century-old fight over water from Oregon’s Klamath Basin ended Thursday with signed agreements that assure farmers water and power to keep their crops green, and lay out the removal of dams that have blocked salmon from hundreds of miles of spawning grounds.

For decades, American Indian tribes, farmers, salmon fishermen and conservation groups have fought in courts and centers of power over who gets the scarce water in the basin – the farms and ranches through irrigation or the salmon and suckers in rivers and lakes.

The groups gathered with state and federal officials in the Oregon Capitol beneath murals of heroic Western pioneers, Indians, farmers and salmon fishermen and amid Native American prayers and songs to sign two landmark agreements.

“In times gone by our people were healthy, the river was healthy, and the fish were healthy,” said Thomas O’Rourke, chairman of the Yurok Tribe, based at the mouth of the Klamath River in Northern California. “Now I look at the river and the river is sick. We are going to set the river free.”

Luther Horsley, president of the Klamath Water Users Association representing farmers, said when they started talking instead of fighting five years ago, they found out they had more in common with longtime enemies than they thought – a desire for “a future for our children and our children’s children.”

“The only way this is going to work is if it’s a healthy watershed for all of us, going on for 50 years,” he said.

One agreement lays out a roadmap for removing four hydroelectric dams from the Klamath River in Southern Oregon and Northern California. The other details how to share water between fish and farms and restore the ecological balance of the basin. Water will be shut off to farms in extreme drought.

They mark the end of an era when the government and the people thought they could turn nature upside down to make a better life, and a pathway to peace in one of the most hotly fought water wars in the nation.

“You wanted a future without conflict and understood that doing nothing wasn’t an option,” Oregon Gov. Ted Kulongoski told more than 500 people who filled the rotunda to overflowing. “You love the land. You love your communities. You want a future of hope and prosperity, and now you will have one.”

U.S. Interior Secretary Ken Salazar said the agreements marked the end of one of the “most intractable water wars in the country,” and the beginning of “the largest river restoration in the world.”

“Let us build a legacy for the American people that can be emulated across the country and across the world,” Salazar said.

California Gov. Arnold Schwarzenegger praised the parties for forgetting their differences in the interests of a better future, then invoked his movie roles as The Terminator, saying, “Hasta la vista” to the dams, and adding, “I can see already the salmon fish are screaming, `I’ll be back.”’

The dams produce enough power for 70,000 people. Removal is not scheduled to start until 2020 and depends on funding, authorization from Congress and a federal determination that it will actually help salmon and is in the public interest.

PacifiCorp, the utility that owns the four dams, will not bear the estimated $450 million cost for removing the dams. Oregon and California share the costs with surcharges on PacifiCorp customers and a $250 million bond not yet approved by California voters.

The utility serves 1.6 million customers in Oregon, California, Washington, Idaho, Utah and Wyoming, and is owned by MidAmerican Energy Holdings Co., a unit of Warren Buffett’s Omaha, Neb.-based Berkshire Hathaway Inc.

PacifiCorp CEO Greg Abel said the agreements fulfilled the company’s two goals: finding a balance fair to all the parties, and protecting the interests of the utility’s customers.

The conflict stretches back to the early 1900s, when the federal government turned the hydrology of the upper Klamath Basin upside down, drawing water from lakes and rivers to irrigate crops on dry uplands. Veterans of World War I homesteaded the Klamath Reclamation Project straddling the Oregon-California border near Klamath Falls, where potatoes, alfalfa, horseradish and cattle are still grown.

In 2001, a drought brought the conflict to a head.

Irrigation for farms had long been constricted to assure enough for endangered sucker fish in Upper Klamath Lake, the project’s main reservoir. Then coho salmon were declared threatened in the Klamath River, flowing out of the lake, and the Endangered Species Act forced water to be shut off to hundreds of farms and ranches.

The next year, the Bush administration restored water to the farms, but with the river low and warm, tens of thousands of chinook salmon died of disease before they could spawn.

Besides blocking salmon, the dams raise water temperatures to levels unhealthy for fish. California water authorities have been taking a hard look at the toxic algae produced by the dam’s reservoirs, and river advocates have sued PacifiCorp to fix the algae problem.

Pressure has been building since PacifiCorp applied for a new 50-year federal operating license in 2004 and made no provision for fish passage, which stops at Iron Gate Dam near the Oregon-California border.

California and Oregon’s governors pressed for dam removal after West Coast commercial salmon fisheries collapsed in 2006 because of declines in Klamath River returns, triggering a disaster declaration.

The agreements signed Thursday also call for spending $1 billion in federal funds over the next ten years on environmental restoration.

Kulongoski said studies on the project have already begun, and National Oceanic and Atmospheric Administration chief Jane Lubchenco said the government was committed to seeing it through.

“We have come too far to be derailed now,” she said.