Pedro Sanchez has been reelected prime minister of Spain.
The vote came after nearly two days of debate among party leaders that centred almost entirely on a highly controversial amnesty deal for Catalonia’s separatists.
Mr Sanchez agreed to the bill in return for vital support of six smaller parties to get elected prime minister again.
The Socialist Workers’ Party (PSOE) leader, who has governed Spain since 2018, was backed by 179 politicians in the 350-seat lower house of parliament.
Only right-wing opposition parties voted against him.
As the vote was completed inside, outside parliament, angry protesters shouted and shook police barricades.
The protests on Thursday were a continuation of nightly demonstrations outside PSOE headquarters in Madrid
that began two weeks ago.
Many citizens are angered by the amnesty bill, which would mean any politicians and activists who were convicted for taking part in an attempt to separate Catalonia from Spain would be pardoned.
Those who helped facilitate Catalonia’s two independence votes in 2014 or 2017 will receive amnesty, and those who tried to prevent the ballots – such as police officers accused of using excessive force – are also protected by the proposed law.
Read more world news:
Inside Gaza’s ‘humanitarian corridors’
Women and children rescued after armed gang surrounds hospital
At least 26 killed and dozens injured in China fire
The law would particularly benefit former Catalan regional president Carles Puigdemont, who is a fugitive from Spanish law and considered public enemy number one by many in Spain.