But support for independence is far more limited in places like L’Hospitalet de Llobregat, the second-largest city in Catalonia, whose mayor, Núria Marín, has been leading the call for mayors not to be intimidated into hosting the referendum.

“I was elected to manage a city, not to provide ballot boxes,” she said in an interview. “Telling me that I should help people vote is a political and not a legal argument — and in this case it’s clearly not one that carries a lot of weight if made before a judge.”

Spain’s attorney general has warned Catalonia’s political leaders that they could be arrested at any time and face criminal charges for misusing public money to finance an illegal referendum.

The separatists, however, have lashed out at Madrid’s efforts to prosecute mayors and eventually, perhaps, thousands of other officials involved in their referendum. They say Mr. Rajoy is returning authoritarianism to Spain.

Mr. Rabasseda, the mayor of Arenys de Munt, said that Madrid’s clampdown has been disproportionate. He was prepared for a court battle, but acknowledged that his legal problems were worrying others, starting with his 86-year-old mother.

“She’s really upset and concerned,” he said. “For her, it’s a bit like returning to the past and the loss of all political freedom.”