FIVE POINTS, Calif. - At the height of farmer John Diener's agricultural wastewater problems in the mid-1990s, a virtual underground sea of tainted water had risen to within a foot of his cotton crop's roots.
The steadily rising, increasingly toxic groundwater laced with salt and selenium was a looming environmental disaster that, if left undrained, was a few years from completely destroying hundreds of acres of prime agricultural land on Diener's San Joaquin Valley farm.
''I had to get moving on something or I'd not be in production very long,'' Diener said.
Diener's runoff problem is shared by hundreds of farmers on about 2.4 million acres of land in the western San Joaquin Valley. The area, roughly bordered by Interstate 5 to the west and state Route 99 to the east, runs from Bakersfield to Tracy.
Since 1994, Diener's Red Rock Ranch near Five Points has been the site of a waste water experiment that researchers hope will help solve the valley's massive agricultural drainage problem.
In other places around the state, rain or irrigation water seeps into the soil and dissipates naturally, but because of a thick underground clay layer, the water in the western San Joaquin Valley becomes trapped beneath the surface with no place to go. The water table gradually rises and when it reaches the roots, it will waterlog and kill the plants.
The toxic metal selenium and salt further damage the soil. In high concentrations, selenium, which occurs naturally in the valley and is an essential nutrient for humans and animals, can cause health problems or even death.
To lower the water table, an irrigation system of subsurface drains has been installed on Diener's farm. The system traps the water and reuses it in salt- and selenium-resistant crops.
During each use, water is consumed but most of the contaminants leach back into the drainage system. At the end of the process, Diener is left with a relatively small amount of highly contaminated water.
The briny water is then pumped into a shallow pond where it evaporates, leaving behind a layer of salt and selenium. Researchers are now looking for potential commercial uses for the sun-baked residue, including use in manufacturing construction materials.
''The drainage water is used for farming and the salt and selenium doesn't leave the boundaries of Red Rock Ranch,'' said Vashek Cervinka, a researcher with the State Department of Water Resources who is running the project.
''If all farmers did what John Diener is doing, we would protect the quality of water in our rivers and lakes and groundwater,'' Cervinka said.
Diener's drainage solution, which so far has cost about $700,000, also includes using several groves of mature eucalyptus trees as ''biological pumps.'' An acre of the trees can evaporate up to six acre-feet of water in a year, so farmers are beginning to use them to lower the water tables in the valley.
To date, the effort has yielded promising results, Cervinka said. The salt and selenium levels on Diener's farm have been reduced by 90 percent and the water table is slowly beginning to recede.
While a massive, multibillion-dollar drainage project begun in the 1960s remains stalled by environmental concerns, the tainted groundwater continues to swell beneath the western valley, threatening to within five feet of as many as 500,000 acres of farmland and to within 10 feet of an additional million acres, said Manucher Alemi, chief of the joint state and federal effort to find a long-term drainage solution for the area.
The drain, as originally designed, would have emptied into the Delta near Antioch. Opponents fear a buildup of selenium, which was found in waterfowl in Merced County in 1983 when the reservoir was used as a temporary end point for the drain.
But farmers sued the federal government after the drainage project was abandoned, citing decades-old water contract language that gives the government responsibility for clearing the used water from beneath the valley's fields.
In February, a judge ordered the federal government to remove the salty irrigation water from the western San Joaquin Valley, but also said options other than the controversial drain could be sought.
In addition to Diener's project, government research has focused on water conservation and purification, among other things.
Still, environmentalists have said for years that the salt and selenium problems in the valley are far beyond any solution other than simply eliminating farming on most of the land and letting it revert back to its natural state.
''(Diener's project) sounds like a pie in the sky,'' said Lloyd Carter, president of the California Save Our Streams Council.
''Three million tons of salt a year come into the westside via irrigation; it's already a salt-laden desert. All (Diener) is doing is rearranging the chairs on the Titanic,'' Carter said.