Handing a victory to investors hoping to build one of the world's largest solar farms, a San Benito County judge has rejected a legal challenge by environmental groups who say the project would harm wildlife.

In a nine-page ruling, Superior Court Judge Robert O'Farrell said that members of the San Benito County board of supervisors did not violate state law last year when they approved the $1.8 billion proposal to put up to 4 million solar panels in Panoche Valley, an arid expanse of rangeland about 50 miles southeast of Hollister.

"What we're trying to do is benefit the environment and reduce California's dependency on dirty fossil fuels," said John Pimentel, president of PV2 Energy, a firm with offices in Menlo Park and San Francisco. "We would expect to have widespread support from the environmental community because of the beneficial impact for air quality and energy security."

But the Santa Clara Valley Audubon Society, the Sierra Club and a group of local residents known as Save Panoche Valley sued to block the project, claiming the 399-megawatt project that would be constructed across the roughly 3,200 acres west of Interstate 5 would disrupt the rural character of the area and harm the endangered San Joaquin Kit Fox, blunt-nosed leopard lizard and giant kangaroo rat.

The judge turned back the groups' arguments, saying that the county supervisors properly followed the California Environmental Quality Act and the Williamson Act, particularly since the developers agreed to buy 23,000 adjacent acres and place them in permanent conservation easements.

Pimentel said his company hopes to break ground by 2013 or 2014, and the project's opponents said Thursday they haven't decided whether to appeal.

"We are very disappointed," said Shani Kleinhaus, an advocate with the Santa Clara Valley Audubon Society, based in Cupertino. "We think the environmental harm will be substantial."