Spain’s former prime minister Mariano Rajoy has mounted a robust defence of his handling of the Catalan independence crisis and blamed the police violence that marred the illegal referendum in October 2017 on the separatist politicians who organised the vote.

Giving evidence in the trial of 12 Catalan leaders charged over their alleged roles in the push for independence, Rajoy said responsibility for the injuries people suffered as police raided polling stations lay with the secessionist government of the former Catalan president Carles Puigdemont.

“If they hadn’t called people to vote in an illegal referendum and hadn’t made decisions that broke the law, neither you nor I would have had to see the injuries that some people and some members of the security forces had,” he told defence counsel at the supreme court in Madrid on Wednesday afternoon.

After the court watched a brief video of people showing their injuries to TV cameras, Rajoy said: “I deeply regret that. I don’t like [these images] or others. That’s why I think that political leaders have a duty to work to ensure that the conditions don’t arise for these images.”

Over the course of 100 minutes of often tetchy testimony, the former premier repeatedly defended his government’s decision to take the unprecedented step of using the Spanish constitution to sack Puigdemont and his administration and assume direct control of the region.

“I think we were careful,” he told the court, saying he had always been abundantly clear to both Puigdemont and his predecessor, Artur Mas, that the Spanish government would never accept a unilateral referendum.

“They knew full well from the first day I met Mr Mas that I would not allow a referendum that would eliminate national sovereignty and the unity of Spain,” he said.

Rajoy led the conservative People’s party (PP) government between 2011 and 2018. He was eventually forced from office in June last year when the opposition socialists brought a successful no-confidence motion against him after several former PP members were convicted of corruption.

Nine of those on trial – who include the former Catalan vice-president Oriol Junqueras, the former speaker of the Catalan parliament Carme Forcadell and two influential grassroots activists, Jordi Cuixart and Jordi Sànchez – are accused of rebellion, which carries a prison sentence of up to 25 years. Other charges include sedition and the misuse of public funds.

Defence lawyers are seeking to undermine the charges of rebellion, which under Spanish law is defined as “revolting violently and publicly”. They argue that none of those charged with the offence engaged in violence during the pursuit of independence. Giving evidence two weeks ago, Junqueras said he was a “political prisoner … on trial for my ideas”.

The trial, which is expected to last three months, continues.