Officers from Catalonia’s autonomous police force, known as the Mossos, watched voters stream in but made no move to interfere.
Then, shortly after polls opened at 9 a.m., Spanish national forces in riot gear entered several sites, including the high school in northeastern Catalonia where the region’s leader, Mr. Puigdemont, was expected to vote.
Ada Colau, the left-wing mayor of Barcelona, called on Prime Minister Mariano Rajoy to resign over his “cowardly” and unjustified police intervention.
“Today we’re not talking about independence or not, but about a breakup between Mariano Rajoy and his government with Catalonia,” she told reporters.
Overnight, Catalans had used tractors to block police access to some rural municipalities so that the vote could go on. In other places, residents removed the doors of polling stations to ensure that the police could not bolt them on Sunday.
Catalans are voting not only without backing from Madrid, but also without any sign of support from the European Union or other major players in the international community. The vote is happening in makeshift conditions, with a disputed census used as the voting list.
They are relying on privately printed ballots, after millions of them were seized recently by the police. To prevent a shutdown, the Catalan government changed the voting rules an hour before poll stations were scheduled to open on Sunday, allowing Catalans to cast a ballot in any poll station, without using an envelope and whether registered there or not.
Mr. Millo, the Spanish government’s representative, said the last-minute change turned what was already an illegal Catalan referendum into “a joke.”
Mr. Millo said the police were ordered to seize election-related equipment and not people, but news channels showed violent altercations. Carles Soler, 52, said he was hurting as he walked barefoot down Carrer Sardenya in Barcelona, after “a police officer hit me from behind.” He added: “My flips flops didn’t resist either.”
As the tensions mounted on the streets, F.C. Barcelona, the soccer club, was considering postponing a match scheduled to take place in its Camp Nou stadium later on Sunday afternoon.
A few outsiders had traveled to Catalonia from other countries to act as observers, saying they wanted to make sure that the police did not use force against voters.
Dimitrij Rupel, a former foreign minister of Slovenia, led a delegation of 35 foreign officials invited by the Catalan government. After watching the police intervene, he said that the “police have nothing to do with the democratic process — they shouldn’t be here.”
Others compared the situation in Catalonia with that in their own independence-minded regions, precisely what has concerned European Union officials and neighboring governments.
“Every person in the world should have the right to decide their present and future, which of course means the right to vote,” said Andrea Favaro, an Italian lawyer, who waited inside a polling station early on Sunday. Mr. Favoro is from the Veneto region that has held a nonbinding ballot on independence from Italy.