Barcelona(CNN) The images shocked Spain and reverberated around Europe. Officers with Spain's national security forces, in full riot gear, smashing their way into polling stations, dragging women out by the hair, and firing rubber bullets indiscriminately into crowds as they turned out to vote.

It was all part of a coordinated crackdown on Catalonia's disputed independence referendum -- banned by Spain's highest court, but held in defiance of Madrid by Catalonia's passionate separatists who felt their long-held dream of an independent state was close at hand.

Despite the attempt to thwart the vote, more than 2 million Catalans made their voice heard. Now CNN has learned more details of the extraordinary covert operation that was mounted to ensure the referendum took place.

A network of thousands of officials and volunteers squirreled away ballot boxes, conferred by encrypted messages and met in secret in an effort to get as many people to the polls as possible.

From the educators who opened up their schools to the people who ferried the ballots and anyone who counted the votes, all risked a fine of up to 300,000 euros (about $350,000). Higher-ranking officials could even face jail. The chief of the Catalan police force, Josep Lluís Trapero, was called to Madrid this week to answer accusations of sedition, or fomenting a rebellion against the state, a crime that carries a maximum 15-year prison sentence.

CNN spoke to one man involved in the operation. Aleix, not his real name -- he spoke to CNN on condition of anonymity to avoid potential legal ramifications -- coordinated the operation at a polling station on the outskirts of Barcelona, the regional capital.

His involvement began three months ago with a phone call from referendum organizers. "They knew me, that I would help. So they called me," Aleix told CNN.

Secret meetings

Phone calls turned into texts and a virtual game of cat and mouse. The plotters started using Whatsapp, but were worried it was compromised and turned to other encrypted platforms such as Telegram and Signal. Meetings were held in secret, some were canceled last minute out of fear.

"In the end (everyone involved) met three days before the vote," Aleix says. "I bumped into people I didn't know would be there. Everything was very secretive."

The ballot boxes were assembled at the last minute, he said. In order to try to fool Spanish authorities, the components -- the plastic box, the lid, the insignias, and the box ties -- were stored in separate places.

The night before the vote, he and other activists slept at his assigned school to make sure authorities didn't seal it off. People tucked into sleeping bags spread across the gym floor. In the middle of the night, he says, he got a call asking him to move some ballot boxes and ballots.

"I was sleeping at the school and (the caller) told me to meet him somewhere in the city to move the material from one car to another," Aleix says. "We brought the material to three different schools."

People queue to vote in the banned referendum on Catalonia's independence.

By dawn there was a line of voters snaked around the school corner. Some stood for hours, hearts racing as word spread that polling stations were being raided. Tweets and Facebook posts popped up on smartphones, showing voters and coordinators being beaten by the national police.

"We were informed the police had paid a visit to a school five minutes away from ours and there had been very violent clashes," Aleix says. "I was the person in charge of that school. I felt pressure and was scared that people there would be beaten, that police would storm in violently and hurt many old people and children. My family was there, my parents were there, so that fear was there."

Madrid denies that excessive force was used. "If there was any use of force by police, in any way, it was because they were prevented from doing what they were asked to do," Spanish Foreign Minister Alfonso Dastis told CNN.

Voting irregularities

Voting was plagued by technical difficulties and confusion. Aleix says some volunteers only received their instructions at the last minute, and the websites they were using to check voter identification jammed; he was meant to coordinate four voting stations but for most the day he was only able to run two.

He admits there were irregularities. At some stations, voter identities could not be verified electronically. People were allowed to vote anyway. The final result is still being tallied.

The Catalan President, Carles Puigdemont, is expected to make a unilateral declaration of independence at some point after a special session of the Catalan Parliament on Monday.

On Wednesday evening in Barcelona, a small group of Catalans who oppose independence gathered to show their support for Spanish institutions. Some of those who spoke to CNN said they felt that a large number of Catalans who oppose independence feel unable to speak out for fear of recriminations in the current polarized atmosphere.

But despite all of the problems, Aleix insists this referendum reflects the will of Catalans.

"The problem may be that people didn't want to vote out of fear of the police," he says. "The result maybe is not the best because not all the people finally vote. But I think it is legitimate."