An hour later, after police had driven away in their big black vans, under a hail of insults, the ballot boxes reemerged and the voting recommenced.
The pattern was repeated again and again across hundreds of polling stations Sunday in the Catalan region of northeast Spain, where a secessionist movement is pushing ahead with a disputed referendum on independence that the central government in Madrid, backed by the courts, has called illegitimate and illegal.
By late afternoon, the regional authorities said 844 people had suffered minor injuries in brawls with police, who dragged protesters out of their way and whipped them with rubber batons. The officers fired scores of rubber bullets at crowds gathered at voting centers in Barcelona and other cities. Officials in Madrid said a dozen police officers had been injured.
In a television address, Spanish Prime Minister Mariano Rajoy said there was no independence vote Sunday in Catalonia, the Associated Press reported. He said that a majority of the residents of the region had declined to vote for secession.
The portrayal of the day's events could not have been worse for the central government. Although Madrid might have had the Spanish Constitution on its side, the images being blasted around the world out of Catalonia showed ordinary men and women being dragged from the polls by helmeted police dressed all in black.
The vote in Catalonia was a mass act of civil disobedience, organized by the regional government but propelled by WhatsApp groups, encrypted messages and clandestine committees.
Thousands of parents and their children were deployed to occupy hundreds of polling stations before the vote to keep them from being locked down by National Police and Guardia Civil militia officers.
As the central government shut down websites promoting the referendum, new apps popped up to guide voters.
The clash between the central state and its citizens saw mass demonstrations in the past two weeks and a high-risk game of cat-and-mouse, as the secessionists sought to carry out a vote that Madrid vowed it would stop. The Catalan government, dominated by breakaway leaders, said that despite police raids, more than 70 percent of the polling stations were open Sunday afternoon.
Long lines snaked around the blocks in Barcelona. In the countryside, farmers circled the polling stations with tractors to protect the ballot.
The region's police force stood aside and did not raid the polling stations. Instead, firefighters sought to preserve calm and keep the crowds and National Police from setting upon each other.
The regional president, the pro-secession Carles Puigdemont, said Rajoy should be ashamed of himself, while Catalans should be remembered for acting with bravery and dignity. Barcelona Mayor Ada Colau called the day's events between citizens and police "a rupture."
In the former textile town of Sabadell, the fifth-largest city in Catalonia, hundreds of volunteers spent the night in the schools used as polling stations, strumming guitars and singing folks songs from the old days. As they awoke in sleeping bags sprawled in the hallways, their neighbors were sneaking the ballot boxes into auditoriums.
Francesc Codina had spent the past three weeks hiding the boxes in a dusky wine cellar in the heart of the city. Later, the plastic tubs, with the seal of the Catalan government, were ferried around town, stashed in black plastic.
"They were disguised as bags of trash," Condina said. "But this was democracy we carried in our hands."
Codina said informers and intelligence officers were searching everywhere for the ballots and boxes.
He shrugged. "But there's lots of hiding places."
At a high school for industrial training, Teresa Macia was volunteering as an observer for the vote. Asked whether she was afraid of violence or arrest, she answered, "No. And even if they scared me a little bit, it would be worth it."
Meanwhile, the Spanish soccer league game between Barcelona and Las Palmas at the Camp Nou stadium went ahead without any fans in attandance.
Just before the polls opened at 9 a.m., the Catalan regional government declared that any registered voter could vote anywhere — instead of having to visit their assigned polling station in their home towns. The voting lists, the regional government said, would be digital and not printed as usual for the polling officers to check against identification cards.
But there were problems right away with registering the voters — and the online system was balky. And this, among all the other irregularities, raised questions about the legitimacy of the chaotic vote. Those who opposed the vote — especially the people who want to remain in Spain — scoffed that the Catalans were being allowed to vote as many times as they like. The regional government announced that it knew about the technical problems and was urging patience.
Anna Fernandez, a neighborhood computer whiz, was asked to come quickly to the Escola Nostra Llar, Our Home School, just before the voting began to help get the glitchy digital lists to work.
"Then the police came through the windows," said the mother of three, all of whom attend the school. "They came with big hammers. The old people locked their arms together and tried to stop them. They were shouting at us, 'Where are the ballots? Where are the boxes?' But by then, I don't know what happened, but all the material, the papers, the computers, they had all disappeared."
She smiled and said, "And then the ballots were found and the people are starting to vote again."
As the National Police left without the ballots, the crowd hurled insults at them, calling them cowards, traitors and worse. An hour later, a new and longer line of voters stretched down the block, laughing and sharing videos, under their umbrellas in the rain.
Enric Millo, Spanish government's top official in Catalonia, said the National Police were professionals acting with restraint and within the law to enforce court rulings to stop a seditious vote that seeks to tear the country apart.
Spain's deputy prime minister, Soraya Sáenz de Santamaría, said in a news conference that the "absolute irresponsibility of the Catalan government has had to be dealt with by the professionalism of the state's security forces. With firmness and proportionality, we have thrown into disarray the Catalan government's plans. There hasn't been a referendum nor the semblance of one. Nothing good will come of this."