In what would be the most significant water law passed in California in nearly 50 years, lawmakers in Sacramento are working with Gov. Jerry Brown on a landmark measure to regulate groundwater pumping for the first time.

With an Aug. 31 deadline until the end of the legislative session and billions of dollars at stake, negotiations among farmers, environmentalists, cities and officials are reaching a crescendo.

Although landowners who want to divert water from reservoirs and rivers have been required to get a permit from the state since 1914, farmers and cities who tap aquifers — California's largest water source — can pump as much as they want, when they want and with almost no oversight or limits.

As a result, decades of intense pumping have dropped water tables dangerously low in such places as the San Joaquin Valley and Paso Robles. Scientific studies show the ground is sinking in many hard-hit areas and that aquifers are at risk of running dry.

"It's like a shared bank account. But nobody ever has to balance the checkbook," said Lester Snow, former director of the state Department of Water Resources.

California uses more groundwater than any state, relying on it for 40 percent of its total water supply in most years and 60 percent in dry years. Yet it is the only state in the West without rules to ensure it doesn't run out.

Snow and other reformers are supporting a bill by state Sen. Fran Pavley, D-Agoura Hills, that would require local government officials, probably counties in most cases, to bring their groundwater basins up to sustainable levels.

If the bill is enacted, local agencies would be required to regularly measure water tables and set numerical goals. Each county could use a wide variety of tools, including setting up programs to recharge aquifers by putting more water in the ground, and requiring farmers — some of whom don't have meters on their wells — to carefully measure and report how much they pump.

If local governments didn't set up oversight systems or failed to show progress, state officials could write, and then enforce the local rules.

"Groundwater is a critical source of water for families, farms and businesses across the state," Pavley said. "And if we want it to be available in the future it needs to be managed sustainably."

The governor has made Pavley's legislation a top priority. But her bill is drawing opposition from the state's main farm organization.

"At some point in time there has to be some accountability, and we have to get a handle on how much we are pumping," said Paul Wenger, president of the California Farm Bureau Federation. "But this is bad legislation, and we oppose it. … The unintended consequences are going to be huge. The financial impacts are going to be huge."