Spanish police clear the entrance of a polling station in Barcelona | Pau Barrena/AFP via Getty Images Catalan crisis deepens after day of violence Region ‘earned right … to independent state,’ announced Catalan leader in Barcelona, while Madrid holds firm against secession.

BARCELONA — The day of Catalonia's contested referendum on independence turned into a brutal show of strength, sometimes turning violent, between the central government in Madrid and separatist leaders here in Barcelona.

In the wake of a vote that was disrupted by police and marred by clashes, one whose legitimacy can be embraced or rejected depending on one's political or national colors, the one sure outcome is the hardening of views and positions on all sides.

After midnight Monday, the regional government announced the results: 2.26 million people voted, accounting for 42 percent of the electorate, 2 million of whom voted ‘Yes’ to independence, 176,566 No and the rest handing in void or blank ballots.

Catalonia's regional president on Sunday night declared the region had "earned the right" to become an independent state, while the Spanish prime minister vowed to hold a firm line against any moves toward secession.

Madrid and Spain will now have to grapple with a renegade province in its northeastern corner. The Catalan crisis evokes comparisons to the country's bitter 20th century history of civil war and regional conflicts and offers no simple constitutional or political answers.

“We Catalans have earned the right to be heard in Europe" — Carles Puigdemont

The path in coming days is no easier for Catalonia's rulers, who have chosen confrontation with Madrid to move toward independence, something that has split Catalan society more or less down the middle. Their referendum as such offers limited practical support for independence, having been forced through over the objections of courts and the national government. Opponents of independence in Catalonia were likelier to stay away than turn up to vote, and have complained that their voices were drowned out in recent months.

As for the EU, the bloc suddenly has to contend with a serious constitutional and political crisis in its fifth largest member country. For now, the other 27 states are behind Madrid, though a couple leaders have already expressed discomfort with Spain's handling of the referendum.

'Earned right to independent state'

Speaking soon after 8 p.m. on national television, Spanish Prime Minister Mariano Rajoy defended the actions of riot police who stormed into polling stations in Catalonia on Sunday to prevent an outlawed referendum on independence.

With condemnations of the violence coming from some Spanish opposition leaders opposed to Catalan independence and politicians across Europe — though not EU governments, with few exceptions — Rajoy stood firm, saying the regional government that organized the vote had "tried to destroy the rights of the Spanish people by violating the law." He added: "Today there was no referendum on self-determination."

Before even the ballots that were cast were counted, Catalan regional President Carles Puigdemont later on Sunday evening declared that the "citizens of Catalonia have earned the right to have an independent state."

He said he will send the official results of the vote to the regional parliament to proceed with what the referendum law states, that is, a declaration of independence. He appealed directly to the EU as well: “We Catalans have earned the right to be heard in Europe.”

Sunday's vote was the most dramatic episode in a long stand-off between Madrid, which refuses to even discuss parting with a region that accounts for a fifth of Spain's economic output, and the secessionist regional government in Barcelona, or Generalitat.

In the weeks leading up to the vote, Spain's attempts to seize ballot papers, take down pro-independence websites and put regional officials and mayors under legal pressure failed to dissuade Puigdemont, who has the backing of the Catalan parliament.

The Generalitat said 761 people needed treatment by emergency services by midday, while Spain’s interior ministry said 11 members of the civil guard and national police had been hurt.

Earlier in the day, Puigdemont condemned what he called “unjustifiable violence” against "people who wanted to exercise their right to vote.”

Despite the efforts of the National Police and Civil Guard, many Catalans were able to vote, and the images on TV and social media of police in riot gear clashing with locals looked set to inflame nationalist sentiment.

'Territorial integrity at stake'

In Madrid, Spaniards opposed to Catalan secession held their own rally and waved the Spanish flag. The ruling Popular Party has the backing of the Constitutional Court and Rajoy has sought the support of EU leaders against the separatists and last week got the backing of U.S. Donald Trump on a visit to Washington.

Opposition leader Pedro Sánchez of the Socialist Party blamed both sides for Sunday's violence but told conservative leader Rajoy the "time for inaction is over" and said he must "negotiate, negotiate and negotiate and reach an agreement" with the Catalans. He said he backed "the territorial integrity of the country, which is now at stake."

Sunday's clashes were condemned by politicians across Europe. The prime ministers of Belgium and Slovenia called for an end to the violence and U.K. opposition Labour leader Jeremy Corbyn tweeted: "I urge @Theresa_May to appeal directly to Rajoy to end police violence in Catalonia & find political solution to this constitutional crisis."

In Scotland, the pro-independence First Minister Nicola Sturgeon tweeted: "A true friend of Spain would tell them today’s actions wrong and damaging." She criticized the British Foreign Office, which said the vote was "a matter for the Spanish government and people."

'Fed up'

Accusing Catalan officials of using children to achieve their illegal ends — a reference to the educational activities arranged in some schools over the weekend to justify keeping them open for voting — Sáenz de Santamaría praised "the professionalism of the security forces.”

In some areas of Catalonia, the Civil Guard and the National Police used riot gear and fired rubber projectiles against pro-independence crowds, according to locals.

Aurora Arnaus, a 66-year-old pensioner standing close to one of the polling stations that was raided — the Ramon Llull School in Barcelona — said she heard shouts and shots being fired during the clashes, though she wasn't close enough to see.

“We’re fed up and we won’t stop because this is a tremendous injustice,” she said. “We came here to vote in peace.”

At Jaume Balmes High School, north west of the city center, between 20 and 30 members of the national police forced their way into a polling station, according to several people who witnessed the operation. No one was arrested and it wasn’t immediately clear if anyone was hurt.

“The national police came with riot gear and violently removed people outside,” said Carlos Manjón, a member of the Catalan Republican Left who was acting as a voting official at the polling station and was inside the building when police arrived.

“They’re hampering our progress and we’re fed up. They’re against democracy" — Ramón Martínez, a 67-year-old pensioner

“They showed up the judicial order at the gate and we opened the door,” he continued. “They took the ballot boxes, the ballot papers and one digital tablet.”

Some polling stations were open for voting and the regional police or Mossos, who were also under court orders to prevent the voting, largely avoided closing off facilities. Pro-independence organizations had called on people to turn up early in the morning to prevent the buildings from being sealed by police. Some people slept on site and others started arriving at 5 a.m. — four hours before the planned hour for the vote.

The Catalan government said 73 percent of voting facilities were working properly and called on people to turn out and cast a ballot.

At Font Pienc school, hundreds of people lined up to vote and locals people said just before midday that voting was proceeding smoothly. Ramón Martínez, a 67-year-old pensioner, said he had already cast a ballot and voted ‘Yes.’

“Catalonia deserves to be independent because we’ve been treated badly for many years," he said. "They’re hampering our progress and we’re fed up. They’re against democracy.”

Early in the morning, Jordi Turull, the speaker of the regional government, announced a last-minute change in the voting system to permit people to vote in any polling station that managed to open, rather than just their designated neighborhood voting locale. Votes would also be valid without official envelopes, he said.

The Spanish interior ministry said, however, that it had disabled the voting software being used by the regional government, meaning voters could cast multiple ballots, which would further undermine the legitimacy of the vote. A spokesman for the Catalan government confirmed that an app they had launched to verify voters' identity had been "taken down."

However, Catalan regional culture councilor Lluís Puig i Gordi tweeted that the voting system was working “in spite of digital attacks.”