Southern California air-quality regulators are fining Valero Energy Corp. $5,000 a day because the San Antonio-based company delayed upgrades to its Wilmington refinery — at the request of California energy officials.

The fine is a minor monetary annoyance for Valero, amounting each day to about half a minute’s worth of profit during the first quarter. But the dispute provides a close-up look at the conflicts that will surface with increasing frequency as California tries to marry two sometimes-competing imperatives: affordable energy and a safe and clean environment.

The California Energy Commission figures Valero’s planned 40-day shutdown, which was set to start in mid-April, would have further crimped strained gasoline supplies and pushed up pump prices at least 20 cents a gallon — an extra $8.8 million a day. The refinery produces 14% of Southern California’s gasoline.

Barry Wallerstein, executive officer of the South Coast Air Quality Management District, was reluctant to extend the May 9 deadline because the Valero project involved long-awaited safety improvements.

“We are mindful of the effect of the increased gasoline prices on the general population and the economy,” Wallerstein said. “In this case, we felt the reaction from the refinery was a knee-jerk reaction, and that there hadn’t been adequate planning for the summertime market.”

The air district has no beef with the state energy officials who wrote to Valero in March, asking the company to put off the shutdown until after the summer driving season, Wallerstein said.

“The Energy Commission looks at the issue as simply a fuel supply, fuel price issue, whereas we’re looking at it as an air-quality, public-health issue,” he said. “This sort of tension will continue to arise, and there will be a greater number of occasions of it.”

Although the state badly needs more fuel production, the few refinery expansion projects on the drawing board face fierce neighborhood opposition and California’s new goals for reducing greenhouse-gas emissions. Similar conflicts are becoming acute at the state’s ports, the only lifeline to outside supplies of crude oil and gasoline.

For the refiner, it was a “damned-if-you-do, damned-if-you-don’t situation,” said Scott Folwarkow, Valero’s director of government affairs. “People are always looking for refiners to do the right thing for the right reasons, and we did that and now we’re getting penalized.”

If the company shut down the Wilmington facility as planned, and fuel prices jumped as a result, Folwarkow said, “consumers would not have been very forgiving…. We would be invited to explain our actions to a lot of folks.”

Experts have blamed a series of refinery troubles for driving California gasoline prices 54 cents above the U.S. average in the first three months of 2007 — a record-high differential, according to the energy commission. Gordon Schremp, the commission’s senior fuels specialist, knew Valero’s scheduled shutdown would have made California’s fuel troubles worse — probably much worse.

“It would have been a double-whammy,” Schremp said. Valero’s fuel output would have plummeted, and since the refiner didn’t stockpile enough gasoline to cover its needs, Valero would also have been buying up whatever local gasoline was available, causing wholesale prices to jump even higher.

“A 20-cent price increase would probably be quite conservative,” Schremp said. “We’re very glad that Valero made the decision to delay. I think it saved California consumers a lot of money.”

The commission doesn’t have the power to regulate refinery maintenance and could only request that Valero voluntarily postpone the project. Assembly Speaker Fabian Nuñez (D-Los Angeles) today is expected to propose that the state oversee refinery maintenance schedules.

The air district’s stance can be explained in part by the importance and the years-long history of the project in question.

Valero is one of only two refineries in the state that still uses an extremely hazardous chemical known as hydrofluoric acid in the production of gasoline. Under pressure from the air district and surrounding communities, the company signed an agreement that required it to modify its processes and install equipment that would diminish the likelihood of widespread harm if the chemical were to be spilled.

The memorandum of understanding with the air district calls for daily penalties if Valero misses the completion deadline.

Valero said the project was 80% complete but the remaining work couldn’t be done without shutting down crucial gasoline-making equipment. It plans to finish the project after the summer driving season, and it expects the air board penalties to hit the $1-million maximum before it can finish installation.

“The statistical probability of a leak is very, very small to remote,” Wallerstein of the air district said. “Nonetheless, the consequences of a leak are significant, and that’s why the agreement exists.”