Spain's acting Prime Minister Pedro Sanchez looked set to clinch another term in office after his Socialist Party (PSOE) on Thursday secured the backing of Catalan separatist party Junts to form a government.
The deal was condemned by the country's opposition as “a humiliation” and came amid high tensions which saw a right-wing politician shot in the face in Madrid and projectiles thrown in protest outside the Socialist headquarters.
A law granting amnesty to those prosecuted over Catalonia's attempt to secede from Spain was included in the deal, the text showed.
Police fired rubber bullets and six people were arrested, authorities said, as officers tried to break up the demonstration in the Spanish capital. Riot police chased protesters down one side street.
Police were searching for two men after the shooting of Alejo Vidal-Quadras, the 78-year-old former head of Spain's conservative People's Party (PP) in Catalonia. They have not yet offered a motive for the attack.
Hospital authorities said Mr Vidal-Quadras's life was not in danger after a gunman and an accomplice drew up near him on motorcycle and shot him in the wealthy Salamanca area of central Madrid at about 1.30pm on Thursday. Rescue workers said a bullet passed through his jaw.
Fireworks and other objects were thrown at police as about 8,000 protesters, according to authorities, waved Spanish flags and demonstrated outside the Socialists' headquarters in Madrid on Thursday.
Banners reading “Sanchez traitor” were held aloft by the demonstrators on the seventh night of protests in Madrid.
Santiago Abascal, leader of the far-right Vox party who attended the protest, told reporters: “We are facing the end of democracy, the biggest attack on national unity ever.”
Other protests were taking place in Barcelona and Valencia.
Business leaders called an “urgent” meeting for Monday.
PP leader Alberto Nunez Feijoo on Thursday called for further protests around Spain.
He accused Sanchez of “dragging our country towards a total and irreversible humiliation”.
“Our civil resistance will be long,” he added.
Santos Cerdan, a senior Socialist official, told a press conference in Brussels that, while his party still had “profound disagreements” with Junts, it had put them aside in the interests of forming a “stable government”.
The agreement included Junts lending its votes in parliament to support legislation for a full four-year term, he said.
But Junts, which seeks another independence referendum for the wealthy north-eastern region, said supporting each law would depend on progress in talks involving Catalonia's political conflict.
Debating and voting on the investiture will take place on November 15 and 16, elDiario.es reported, citing parliamentary sources.
Sanchez's conservative opponents have accused him of putting the rule of law in Spain on the line for his own political gain.
As a deal between Junts and the Socialists edged nearer in the past week, the mood in the country has become increasingly febrile, with protesters clashing with police outside the Socialists' headquarters in Madrid.
Mr Vidal-Quadras is a former head of the PP in Catalonia and an ex-member of the far-right Vox party. "I want to convey my solidarity and wishes for a speedy recovery to Alejo Vidal-Quadras. All my affection at this time for him and his family," Mr Sanchez posted on social media.
An amnesty could exculpate as many as 1,400 activists and politicians involved in the attempt to separate Catalonia from Spain.
Among the beneficiaries is Carles Puigdemont, the Junts leader currently living in exile in Belgium, because of charges he faces as Catalonia's leader during the separatist drive in 2017.
If the amnesty is approved by congress, Puigdemont, 60, would be able to return to Spain and potentially run for office.
Puigdemont hailed the agreement between Junts and the Socialists as a “change of narrative” and a step towards resolving a “historic conflict” between Spain and Catalonia.
He told reporters in Brussels that the amnesty offered reparation for what he described as “political persecution” by Madrid, and a guarantee it would not be repeated.
He said Catalans did not need to recognise they had committed any crime nor apologise – something the Socialists had originally insisted on in negotiations.
Potential amnesty beneficiary Jaume Clotet, former communications chief of the Catalan government who is awaiting trial over his role in creating a website in favour of the referendum, said he supported an amnesty if it meant putting “the counter to zero”, but not if it meant erasing what happened during the independence drive.
Several judges' associations released a joint statement rejecting references to so-called “lawfare” in the agreement, a term used by Junts to describe the alleged use of the courts to persecute pro-independence activists.
The agreement proposes a parliamentary investigation of such cases.
“The Spanish judiciary is independent, not subject to political pressure and has a system of judicial guarantees that averts these risks,” the judges said.
Sanchez is trying to form a government after a July election produced no outright winner.
He reached a deal to govern in coalition with the hard left Sumar platform last month but also needs several other smaller parties to back him in an investiture vote.
At present, even with Junts' support, the Socialists would still fall short of an absolute majority of 176 seats to win a first round vote in the 350-seat congress, or to secure a simple majority in a second vote.
They still need the support of five lawmakers from the Basque Nationalist Party, which offered early support but said it would wait to see the details of a Socialist-Junts deal before confirming.
The vote has to be concluded by November 27 or a fresh election is automatically triggered.