BARCELONA — Catalonia’s president, Carles Puigdemont, declared Sunday that the region had “won the right” to become a separate state after an independence referendum passed despite a violent police crackdown, in one of the most serious tests of Spain’s democracy since the end of the Franco dictatorship in the 1970s.
Catalan officials said more than 840 people were injured in clashes with police sent by the central government to block the vote. But they maintained that balloting had proceeded in almost three-quarters of polling stations.
Catalan regional government spokesman Jordi Turull said early Monday that 90 percent of the 2.26 million Catalans who turned out cast ballots in favor of independence, the Associated Press reported.
Turull said nearly 8 percent of voters rejected independence and the rest of the ballots were blank or void. He said 15,000 votes were still being counted, adding that the results did not include ballots confiscated by Spanish police during raids Sunday.
Speaking on television from Barcelona after polls had closed in the northeastern region, Puigdemont said he would declare independence unilaterally if the final results, due in a few days, confirm that the referendum passed.
‘‘Today the Spanish state wrote another shameful page in its history with Catalonia,’’ Puigdemont said. ‘‘I will make a direct appeal to the European Union’’ to look into alleged human rights violations by the Spanish government, he added.
Under a law passed by the Catalan Parliament, a win of more than 50 percent for the ‘‘yes’’ side will trigger a declaration of independence within 48 hours of the vote regardless of the turnout. The region has 5.3 million voters.
Jordi Sanchez, leader of secessionist group ANC, urged the region to declare independence immediately because of the violent crackdown. The CCOO, one of Spain’s two main labor unions, called for a general strike in Catalonia on Tuesday to protest the police action.
National police officers in riot gear, sent by the central government in Madrid from other parts of Spain, used rubber bullets and truncheons in some places as they fanned out in thick phalanxes across Catalonia to shut down polling stations and seize ballot boxes.
Over the course of the referendum, the day turned almost surreal. The voting went ahead in many towns and cities, with men and women, young and old, singing and chanting as they lined up for hours to cast ballots, even as confrontations with police turned violent elsewhere.
Many voters had camped inside polls to ensure that they would remain open. Even at the end of the day, many of those same voters stayed on, fearful that officers might arrive to seize ballot boxes.
In addition to the hundreds of voters injured in the crackdown, at least 33 Spanish police were wounded, officials said.
Despite the violence, Prime Minister Mariano Rajoy characterized the police actions as the response of “a mature, advanced, friendly, and tolerant democracy — but also a firm and determined one.”
But proponents of the referendum pointed to the heavy use of force as a blight not only on his conservative government, but also on Spain’s still relatively young democracy.
The Catalan vote has been watched with rising trepidation — and no sign of support — by a European Union wary of stoking forces of fragmentation already tugging at the bloc and many member states, where populist and nationalist parties have surged in recent elections.
Nationalism in Spain, a country with a long and painful 20th century history that included civil war and fascism, has been all but dormant since the coming of democracy after the death of the dictator General Francisco Franco in 1975.
There are already signs that Catalonia’s threat to fracture the country is changing that, and that the clashes Sunday will further polarize and harden supporters on both sides.
The Madrid government, with the backing of Spanish courts, declared the referendum unconstitutional and ordered the vote suspended. But that did not stop Catalans from lining up before sunrise Sunday in towns and cities across the region.
“Spain has shown us today its ugliest and darkest face, that which we really thought had disappeared 40 years ago,” said Mario Pulpillo, 54. “You simply can’t use violence against people who just want to vote.”
Despite the police threat, Pulpillo, who uses a wheelchair, said he went to vote “to make sure this was our feast of democracy, not our humiliation at the hands of a Spanish state that believes in repression.”
Spanish authorities accused the separatist government of irresponsibly encouraging voters to violate Spanish law and declared that the referendum had been successfully disrupted.
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 police could not bolt them Sunday.
As Sunday approached, the Madrid government tried everything it could to thwart the referendum: disabling the Internet, confiscating ballots, detaining some officials, and threatening scores more with prosecution.
Catalan officials relied on privately printed ballots, and changed the rules an hour before polls were scheduled to open, to allow voters to cast a ballot at any polling station.