LANCASTER, Calif. — There are at least two things to know about this high desert city. One, the sun just keeps on shining. Two, the city’s mayor, a class-action lawyer named R. Rex Parris, just keeps on competing.

Two years ago, the mayor, a Republican, decided to leverage the incessant Antelope Valley sun so that Lancaster could become the solar capital “of the world,” he said. Then he reconsidered. “Of the universe,” he said, the brio in his tone indicating that it would be parsimonious to confine his ambition to any one planet.

“We want to be the first city that produces more electricity from solar energy than we consume on a daily basis,” he said. This means Lancaster’s rooftops, alfalfa fields and parking lots must be covered with solar panels to generate a total of 126 megawatts of solar power above the 39 megawatts already being generated and the 50 megawatts under construction.

To that end, Lancaster just did what former Gov. Arnold Schwarzenegger failed to do in 2006: require that almost all new homes either come equipped with solar panels or be in subdivisions that produce one kilowatt of solar energy per house. He also was able to recruit the home building giant KB Home to implement his vision, despite the industry’s overall resistance to solar power.