BARCELONA, Spain (AP) — Catalonia's regional government declared a landslide win for the "yes" side in a disputed referendum on independence from Spain that degenerated into ugly scenes of mayhem on Sunday, with more than 800 people injured as riot police attacked peaceful protesters and unarmed civilians gathered to cast their ballots.

Catalonia has "won the right to become an independent state," Catalan president Carles Puigdemont said after the polls closed, adding that he would keep his pledge to declare independence unilaterally from Spain if the "yes" side wins.

"Today the Spanish state wrote another shameful page in its history with Catalonia," Puigdemont added, saying he would appeal to the European Union to look into alleged human rights violations during the vote.

Catalan regional government spokesman Jordi Turull told reporters early Monday that 90 percent of the 2.26 million Catalans who voted chose the "yes" side in favor of independence. He 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.

The region has 5.3 million registered voters, and Turull said the number of ballots didn't include those confiscated by Spanish police during violent raids that aimed to stop the vote.

No one knows precisely what will happen if Catalan officials actually follow through on their pledge to use the vote — chaotic as it was — as a basis for declaring the northeastern region independent, a provocative move that would threaten Spain with the possible loss of one of its most prosperous regions, including the popular coastal city of Barcelona, the regional capital.

Hundreds of police armed with truncheons and rubber bullets were sent in from other regions to confiscate ballots and stop the voting, and amateur video showed some officers dragging people out of polling stations by the hair, throwing some down stairs, kicking them and pushing them to the ground. Anguished, frightened screams could be heard.

Police were acting on a judge's orders to stop the referendum, which the Spanish government had declared illegal and unconstitutional — and Prime Minister Mariano Rajoy said going forward with the vote only served to sow divisions.

In a televised address after the majority of polls closed Sunday, he thanked the Spanish police, saying they had acted with "firmness and serenity" — comments sure to anger Catalans.

Spanish Foreign Minister Alfonso Dastis said the violence, while "unfortunate" and "unpleasant" was "proportionate."

"If people insist in disregarding the law and doing something that has been consistently declared illegal and unconstitutional, law enforcement officers need to uphold the law," Dastis told The Associated Press in an interview.

Catalans favoring a break with Spain have long wanted more than the limited autonomy they now enjoy, arguing that they contribute far more than they receive from the central government, which controls key areas including taxes and infrastructure. The police aggression on Sunday was likely to only fuel the passion for independence, and the main separatist group urged the regional government to declare independence after the violent crackdown.

By day's end, Catalan health services said 844 civilians had been treated in hospitals for injuries, including two in serious condition and another person who was being treated for an eye injury that fit the profile of having been hit by a rubber bullet. Thirty-three police officers were also injured.

Officials planning the police operation may have failed to take into account the ubiquitous use of smart phones with video recorders as violent images were broadcast across the world.

At the Pau Claris School in Barcelona, amateur footage filmed by one voter showed police roughing up unarmed people standing in their way. Amateur video from other locations showed similar tactics, with people seen being hit, kicked and thrown around by police, including elderly people with their dogs, young girls and regular citizens of all stripes. Many tried to shield themselves from being smacked on the head.

There were also some signs of provocation by activists. In footage released by the Spanish Interior Ministry, some protesters were seen throwing objects and metal barriers at riot police.

Elisa Arouca, who was waiting to vote outside the Estel school in central Barcelona, reacted with anger when national police agents yanked her and other prospective voters out of the way, then smashed the door open and confiscated the ballot boxes.

She had been planning to vote in favor of keeping Catalonia part of Spain, but decided instead to join the march for independence. She moved to another polling station to try and cast her vote in favor of breaking away.

"I was always against independence, but what the Spanish state is doing is making me change my mind," she said. "The national police and civil guard are treating us like criminals."

There was no organized campaign for the "no" side in the vote, which most national political parties boycotted because it lacked legal guarantees and was suspended by the courts. Polls in recent years have shown roughly half of the 7.5 million residents of the region want to remain a part of Spain.

Mari Martinez, a 43-year-old waitress, said she didn't vote in Sunday's referendum. "I don't lean toward independence, because we are part of Spain," she said. "Today's violence is not good for anybody. We never should have gotten to this point. Politicians haven't done their job, and they should have reached an agreement a long time ago."

A member of the Israeli parliament, sent in as an observer of the vote, said she was shocked by the use of rubber bullets by Spanish police against crowds of unarmed voters.

"We did expect a normal democratic process," said Ksenia Svetlova, part of a delegation of 33 people invited by Catalan officials to observe the voting process. "We knew that a lot of police were here but still, you know, there should be a respect for the will of the people to vote regardless of what you think of the referendum."

Tensions were running so high that Barcelona played its soccer game against Las Palmas without fans after the team announced the match would be played behind closed doors shortly before kickoff, with thousands of soccer fans already outside the stadium. Barcelona wanted to postpone the game but said the Spanish league refused the request.

Manuel Condeminas, a 48-year-old IT manager who tried to block police from driving away with ballot boxes on Sunday, said police had kicked him and others before using their batons and firing the rubber bullets.

Elsewhere, civil guard officers, wearing helmets and carrying shields, used a hammer to break the glass of the front door and a lock cutter to break into the Sant Julia de Ramis sports center near the city of Girona that was being used as a polling station. At least one woman was injured outside the building, wheeled away on a stretcher by paramedics.

Clashes broke out less than an hour after polls opened, and not long before Puigdemont, the Catalan regional president, was expected to turn up to vote at the sports center. Polling station workers reacted peacefully and broke out into songs and chants challenging the officers' presence. Puigdemont was forced to vote in Cornella de Terri, near the northern city of Girona, his spokesman said.

___

Associated Press writer Alex Oller contributed to this report from Barcelona, and Gregory Katz and Frank Griffiths contributed from London.