California and the federal government signed an agreement on Thursday on how to protect the water and the wildlife of San Francisco Bay and its vast inland delta, resolving stubborn conflicts that for years had divided the region's farmers, city dwellers, and conservationists.

Concluding a year of negotiations that had continued right up to a final court-ordered deadline, the two sides produced a far-reaching pact and turned a confrontation between a recalcitrant state and a determined federal overseer into a compromise embraced by all sides.The agreement is intended to preserve a vast but ecologically fragile estuary that holds the aquatic lifeblood of central California. If it succeeds in halting the watershed's prolonged environmental decline, it may prove to be a notable achievement in the Clinton administration's effort to manage whole ecosystems rather than regulate one industry and one species at a time.

The arrangement establishes limits on how much fresh water can be diverted from the estuary to agriculture and cities, an effort to protect endangered fish species by insuring that the young fish survive their migrations and that their breeding grounds do not become too salty for survival.

Although both farmers and cities are expected to give up significant amounts of water under the plan, the agreement does not set forth exactly how much water, within the limits set on Thursday, will flow to which users. That kind of detail will be left to state and local officials to work out later.

Farmers will face the greatest costs year in and year out, while cities will feel the effects in mostly dry years, officials said. Commercial and recreational fisheries, they said, stand to gain economically.

Unlike plans for other ecosystems, such as the old-growth forests of the Pacific Northwest and the Everglades in South Florida, which have met with widespread hostility, the plan for the Californian estuary was praised on Thursday by state officials and by representatives of the region's business, agriculture, and environmental groups.

"I think that this is a model for the country," Carol M. Browner, the federal environmental protection administrator, said at the signing ceremony in Sacramento. "You can do it. It took a lot of patience, a lot of listening and a lot of communication."