Spain’s prime minister has called for calm and cooperation as the country’s first coalition government since the 1930s prepares for office.

The plea by Pedro Sánchez follows a tumultuous and extraordinarily bad-tempered week of political argument that presages another fraught legislature.

The prime minister has spent the past few days putting together a cabinet made up of ministers from his own Spanish Socialist Workers’ party and its new partners, the far-left, anti-austerity Unidas Podemos alliance.

On Sunday afternoon, Sánchez spoke of the need for “social, territorial and generational dialogue”, adding that Spain had grown tired of political deadlock, splits and squabbling.

“The citizens are calling on us politicians for a Spain of moderation and not a Spain of tension,” he said. “A Spain that builds bridges of collaboration and not a Spain of vetoes and ruptures. We’ve had enough of those over the past few years.”

Sánchez last Tuesday secured the backing of congress to form his new government by the narrowest of margins, winning 167 votes to 165, with 18 abstentions.

The coalition’s path to victory was far from easy – or polite. The two investiture debates began with the leader of the conservative People’s party (PP) calling Sánchez a sociopath.

It was at least in keeping with the epithets Pablo Casado has hurled at Sánchez in the past, which include traitor, squatter, villain, catastrophe, hostage and compulsive liar.

Casado warmed to his theme still further on Tuesday, when he accused the Socialist leader of being an egotistical “extremist” who had left the country’s future in the hands of “terrorists and coup-mongers” from Catalonia and the Basque country.

Sánchez, meanwhile, branded his rightwing opponents a “coalition of the apocalypse” and sore losers to boot.

An MP from one of the pro-independence Catalan parties loathed by Casado informed congress that she “didn’t give a damn about the governability of Spain” – shortly before her party’s abstention returned Sánchez to office.

The week was rounded off by a frank assessment of the new cabinet from the general secretary of the far-right Vox party on Friday.

What did Javier Ortega Smith make of the ministers in the new coalition government? “I’ll be honest,” said Ortega Smith. “I don’t know them but I’m sure they’re all really bad.”

Not all the barbs, however, were rhetorical, as one of Spain’s newest MPs soon discovered.

Tomás Guitarte, a 58-year-old architect, was elected to congress last November, becoming the sole MP for Teruel Exists, a movement that campaigns to improve conditions in the overlooked eponymous region of eastern Spain.

Guitarte’s decision to support the new coalition provoked a furious reaction. Graffiti denouncing him as a traitor appeared on walls in Teruel and he received thousands of threats and abusive messages. He was assigned protection officers by Spain’s interior ministry and decided for himself that it would be best not to sleep at home before Tuesday’s decisive vote.

“The very last thing you expect when you stand in an election is that you’ll to have to deal with something like this,” Guitarte told the Guardian.

“It’s meant to be about arguing and defending your positions through reasoned debate when you’re an MP. But they were trying to force an MP to change the way they vote, which is totally anti-democratic and doesn’t make any sense.”

What Guitarte refers to as his “social media lynching” also saw online calls for a boycott of Teruel and its produce. But the initiative backfired after a rival campaign #YoVoyaTeruel (#I’mGoingtoTeruel) was launched and began trending on Twitter.

“The boycott has had the opposite effect,” said Guitarte. “A lot of hotels and businesses say they’ve seen their business increase online. There haven’t been any negative repercussions at all. The sympathy movement was far stronger than the boycott.”

The threats and vilification were not the only things that have caught him unawares; Guitarte was also shocked by the aggressive nature of the investiture debates.

“You can argue your case and your convictions perfectly well without having to resort to attacks and insults,” he said.

Profile Who was Franco? Show Born in 1892 in Ferrol, Galicia, Francisco Franco Bahamonde was a Spanish general and politician who ruled over Spain as head of state and dictator under the title Caudillo between 1939 and 1975. He and other officers led a military insurrection against the Spanish democratic government in 1936, a move that started a three-year civil war. A staunch Catholic, he viewed the war and ensuing dictatorship as something of a religious crusade against anarchist, leftist and secular tendencies in Spain. His authoritarian rule, along with a profoundly conservative Catholic church, ensured Spain remained virtually isolated from political, industrial and cultural developments in Europe for nearly four decades. The country returned to democracy in 1977 but his legacy and place in Spanish political history still sparks rancour and passion.

For many years, thousands of people commemorated the anniversary of his 20 November 1975 death in Madrid's central Plaza de Oriente esplanade and at the Valley of the Fallen mausoleum. And although the dictator's popularity has plummeted, the 2019 exhumation of his body has been criticised by Franco's relatives, Spain's three main rightwing parties and some members of the Catholic church for opening old political wounds. Photograph: Photo 12/Universal Images Group Editorial

“Some of my fellow MPs said that there’s always a bit of theatre in the chamber, but these are people who are also meant to be able to get round a table and decide things for the entire country.”

Bonnie Field, professor of global studies at Bentley University in Massachusetts, said that although “very heated debate” had long been a feature of contemporary Spanish politics, “the tone of this week’s investiture debate was the most corrosive, aggressive and divisive of all investiture debates” since Spain’s return to democracy after 1977.

“It is, in part, a result of greater polarisation – particularly on territorial and national identity issues, and very much intertwined with the Catalan crisis,” said Field.

“However, competition within political blocks also contributes greatly, particularly at a time of party system flux and when voters are less committed to a particular party.”

Much of the most fierce language has come from parties on the Spanish right, which used to be the exclusive territory of the PP. The emergence of Vox, which won 52 seats in November, has dragged both the PP and the once-centrist Citizens further to the right and upped the rhetorical ante.

Pablo Simón, a political scientist at Carlos III University in Madrid, also pointed out that crispación, or heightened tension, is hardly a new feature of Spanish politics. But with the binary certainties of the past long gone, some parties had been pitched into very loud and public identity crises.

“The PP still hasn’t managed to work out what it’s job will be in opposition,” said Simón.

“It’s pretty easy for Vox, which can carry on using tough, crude language as part of its populist rhetorical strategy – a strategy we’ve seen in other far-right parties elsewhere. But the PP is trying to work out how not to get left behind.”

The danger for the PP, he added, was the temptation to keep trying to ape Vox, as the strategy would only alienate more moderate rightwing voters.

On Sunday, thousands of people across Spain took part in a Vox-led demonstration against the new government.

For Field, the week’s scenes in congress revealed both real divisions and underlying political strategies. But, she said, they risked “worsening political disaffection and/or contributing to further political polarisation”.

Guitarte, meanwhile, was struggling to make sense of all that he had seen and heard in congress.

“I know things may be different behind office doors, but the image we project to the country is of what goes on in the chamber, and all the attacks and language and tension can’t be good for society,” he said.

“And besides, there was very little talk of the problems of daily life – it was purely ideological.”