As he stepped up to an outdoor podium on Wednesday in the mountainous eastern town of Teruel, Pedro Sánchez didn’t look like a man hoping to lead Spain’s main opposition party and one day become prime minister. A red banner bearing the insignia of the Spanish Socialist Workers’ Party (PSOE) fluttered behind him in the wind, but Sánchez – wearing a leather jacket, a chequered shirt and jeans – looked more like a casual but fashionable onlooker.

“We all want a winning PSOE,” he said. “But we will only be winners when we stay true to our principles, our ideals, our history, our voters and our activists – and not united with the right.”

Sánchez has become used to being an outsider in his own party. On Sunday, the PSOE will vote for a new leader and this 45-year-old economist is hoping that his stridently leftist rhetoric will win over enough of the party’s 188,000 members to win. Meanwhile, his many enemies in the PSOE fear that victory for Sánchez will spark a Socialist civil war and destabilise Spain’s delicately poised politics.

Rivals

Sánchez’s main rival in what has become a bitter and tightly fought primary contest is Susana Díaz (42), the regional premier of Andalusia who enjoys the backing of many of the party’s senior figures and old guard. Patxi López (57), a former Basque regional premier, appears likely to come third.

Sánchez has already had a spell as party leader, between 2014 and October of last year. During most of the 26 months that he held the post he was a moderate figure, seldom straying from the centrist policies that his party has adhered to for much of the democratic era. But the emergence of the more radical leftist Podemos contributed to his party’s poorest-ever general election results, in December 2015 and June 2016.

In the wake of that latter, inconclusive election, pressure built from within the PSOE for Sánchez to abstain in a parliamentary investiture vote in order to allow prime minister Mariano Rajoy, of the conservative Popular Party (PP), to form a new government and end the political stalemate. Sánchez’s refusal to do so led to a messy conflict which saw him overthrown in October, whereupon a caretaker leadership took over and ordered the party’s members of parliament to abstain in Rajoy’s favour.

Since then, Sánchez has recast himself as the standard-bearer of the party’s left wing, reminding voters of his refusal to help the corruption-plagued PP and promising to reach out to Podemos in the future.

Social media

Ostracised from the party machine, his campaign enjoys the support of several influential unions. It has been driven in great part by frenzied social media activity and financed by crowdfunding and voluntary contributions from PSOE members who are furious at the direction their party has taken.

“People accuse us of being a fan club, as if we were fans of Justin Bieber or something like that,” says María Carmen Soldán (64), a lifelong party member who has been promoting Sánchez’s campaign on Twitter. “I’m not supporting [Sánchez] because I’m a fan, I’m doing it because I want a different kind of party.”

The abstention that allowed Rajoy to form a new administration was “a terrible thing for Socialist activists”, she says. “It broke my heart.”

Pro-Sánchez activists such as Soldán believe the party’s caretaker leadership has been trying to sabotage Sánchez’s campaign with underhand tactics and they also see a hostile press working against him. El País newspaper, which has consistently accused the former leader of being selfish and flip-flopping on policy, asked this week: “Which Pedro Sánchez are party activists voting for this Sunday?”

His rather sudden transformation from middle-of-the-road social democrat to rabble-rousing leftist has made that a common criticism.

“He lacks consistency in his ideas,” says one Socialist Party source who is familiar with all three primary candidates. This source points to Sánchez’s change of tack with regard to dealing with Podemos, his recently discovered determination to empower party militants and an at times confusing definition of the Catalan region’s status.

“He’s a divisive figure and the party cannot afford to be divided, because a party that is fractured is dead,” says the source.

Díaz pounced on these perceived weaknesses in a recent televised debate which highlighted the antipathy between the two frontrunners. “Your problem, Pedro, is you,” Díaz told him. “People don’t trust you.”

Many would say the same about Díaz, who was widely seen as helping mastermind last autumn’s coup against Sánchez and whose own ambitions to lead the PSOE have long been common knowledge.

Díaz is less divisive within the party hierarchy, and apparently less hostile to Rajoy’s PP, suggesting that she offers a leadership that would be more consensual and conducive to national stability. But polls show Díaz is deeply unpopular among many voters outside her native Andalusia. Both contenders, therefore, seem to present a risk for a party suffering one of its biggest crises since it was founded in 1879.