SAN BERNARDINO, Calif. — When this bankrupt, working-class city took the unprecedented step in 2012 of stopping its required pension contributions — arguing that it could not otherwise make payroll — other financially stressed California cities took notice: Could San Bernardino defy Calpers, the powerful agency that administers the state’s huge pension system?

The resistance ended last year when the city resumed its payments. But now, with a mayor who swept into office last month promising to deal once and for all with skyrocketing pension costs, San Bernardino is in another fight with Calpers that could embolden other municipalities seeking relief from crippling payments to the nation’s largest public pension system.

“We are under the microscope, no question about it,” said Carey Davis, 61, the mayor. “San Bernardino took a different approach in bankruptcy as related to pensions, and everybody is waiting to see how it comes out.”

“This city has taken on the 800-pound gorilla, which is Calpers,” said Ron Oliner, a lawyer for the San Bernardino Police Officers Association, which represents the city’s uniformed officers. “Everyone in California is watching San Bernardino, and everybody in the nation is watching California.”

Calpers has for many years resisted all efforts to allow cities, for whatever reason, to stop making their required payments. (Federal law allows bankrupt companies to slow them greatly.) While agreeing that “significant progress has been made in the mediation,” Rosanna Westmoreland, external communications manager for Calpers, said the pension system’s hands were largely tied by statutes mandating that all the pension system’s participants make their full contributions on time and that no workers’ benefits be reduced. “It is the law,” she said.

The problem is that it remains unclear whether, in cases like this, federal bankruptcy law trumps state pension laws. A federal judge hearing the Detroit bankruptcy case ruled, for instance, that federal laws took precedence in that case, so the benefits of city workers in Detroit could be reduced in defiance of state law. But Calpers has insisted that this does not apply to the situation in California, an assertion that may be tested in court, if the mediation provides no solution.

“With Vallejo and Stockton and other cities, everybody is looking at pensions and those obligations,” said Rikke Van Johnson, who, with 10 years in office, is one of the few remaining veterans on the City Council. “We’re all in the same boat. Some of us are just in a little deeper.”

Even before a recent wave of municipal bankruptcies hit California, the California Public Employees’ Retirement System, known as Calpers, had also insisted that under state law, no local government or public agency could reduce the benefits of current workers or retirees.

Calpers handles the retirement of public workers in dozens of agencies and municipalities across the state. With roughly $280 billion in invested assets, there is little doubt it could absorb a $17 million loss, but it has been unbending in its demands, including the insistence that member cities cannot withdraw from the system without paying, in effect, a hefty penalty.

These days, many cities in California are finding it hard to keep up with the bills they get from Calpers. San Bernardino’s annual contribution was $5 million in 2000, but had risen to $26 million by 2012. Other cities like Stockton and Vallejo have tried to emerge from recent bankruptcies without taking on Calpers’s demands, and have had to balance their budgets by firing staff members and trimming services.

While San Bernardino officials hope for a deal with Calpers to get the city out of bankruptcy, they caution that any lasting solution to the high cost for public employee pensions would involve changes to state law.

Mayor Chuck Reed of San Jose, which is having its own public pension problems, has called for a statewide ballot initiative in 2016 to deal with the issue, having decided that this year was too soon to try such a wrenching change.

The city that Mr. Davis took over in early March was already in bankruptcy, with pensions for city workers eating up a steadily larger chunk of its annual budget. “The result is that roads, parks, libraries were not being funded,” he said.

So the mayor was eager one recent morning to show off San Bernardino’s gleaming new airport, built on the site of a shuttered Air Force base, and to talk about other imminent city projects like a new transit center, a new county courthouse and an express bus line running from one end of the city to the other. The slope to economic recovery is a steep one, though.

San Bernardino International Airport, for instance, has everything an airport needs, including ticket counters and jetways, except an airline committed to flying into it regularly. So it sits dark and empty much of the time. The express bus system will not start operating until late April. And the transit center has only just broken ground.

For 35 years, Mr. Davis was an accountant, and for much his career, he was in-house controller for a manufacturing company in Los Angeles. It was while riding Metrolink, the region’s rail system, that he noticed something.

“I would talk to the other commuters, and I often would discover that even those who lived in San Bernardino wouldn’t want to associate themselves with the city,” he said. They would talk about living near other cities, or just speak vaguely about where they reside.

“I found that to be a sad commentary,” said Mr. Davis, a lifelong San Bernardino resident.

So, Mr. Davis said, he took it upon himself to pore over city budgets going back many years. “You could see that there were decisions, many decisions, that put us on this path over the last decade,” he said.

Part of the reason for the problem, he soon realized, was that more than a decade ago, Calpers allowed cities to increase benefits for retirees. The state was flush then. But that did not last, and cities that decided to go along with the higher benefits — like San Bernardino — suddenly found themselves in a deep hole, forced to pay more to make up for the losses suffered by the pension system. It got even deeper when the markets crashed in 2008.

Mr. Davis went to a neighborhood association meeting early last year and spoke up. Afterward, he said, others in the audience urged him to run for office.

He had never even intended to seek public office, he said, but the idea began to gnaw at him. He formed a committee to explore a run. And then, to the surprise of many in the city, he won a runoff against a veteran Council member.

“We are pretty much a city of newcomers at this point,” said Allen J. Parker, the city manager. “Most of the significant players have changed, very recently. I’ve only been on board since November. The mayor has been on board for a few weeks.”

So far, said Mr. Oliner, the lawyer for the police union, the union likes what it sees in the new mayor. But is the union confident that city officials will see that all parties, including Calpers, feel some of the pain of this bankruptcy?

“I think everyone is going to feel pain,” Mr. Oliner said.