Madrid (AFP) - Spain's Socialist party was hit by a "coup" attempt Wednesday with half of its leadership quitting in a bid to oust leader Pedro Sanchez and unblock the country's political deadlock.

But while Sanchez remained silent Wednesday evening, his ally and party number two Cesar Luena told reporters the 44-year-old remained firmly in place.

The Socialists (PSOE) have for months been wracked by internal dissent over Sanchez's leadership during Spain's nine-month political stalemate, as rival parties fail to agree on a government following two inconclusive elections.

The party took a drubbing in two weekend regional polls, and scored historically low results in December general elections and in a repeat vote in June as voters flocked to other upstart parties.

"Seventeen resignations... were handed in today," a party spokesman told AFP Wednesday.

With two separate, earlier resignations, this takes the number of party executives that have quit to 19 out of 35.

Under party rules, according to Luena, an extraordinary meeting of grassroots members must now be called to elect a new executive, and they will also decide on whether they want their leader to remain.

"Tricks and coups don't have their place here," said Luena.

"The Socialist party leader is its secretary general, and the PSOE's secretary general -- elected by party members -- is Pedro Sanchez."

- Could it unblock situation? -

As Spain's political paralysis drags on, some within the PSOE want the party to use its 85 parliamentary seats to help unblock the situation and allow a right-wing coalition government to emerge by abstaining in the necessary vote of confidence.

That, they argue, would avoid a third round of elections and the party could go into opposition and build up strength again.

But instead the Socialists voted against such a coalition government led by acting conservative Prime Minister Mariano Rajoy earlier this month, prompting it to fail.

Sanchez is now trying to form his own coalition with Podemos, the anti-austerity party that wants to replace it as the country's main left-wing force.

Story continues

But he would also need the support and seats of nationalist and separatist groupings in Catalonia and the Basque Country in order to form a government -- despite being firmly against independence for any region.

In a sign of how bad the rift is within the party, former Socialist prime minister Felipe Gonzalez came out against Sanchez on Wednesday morning.

"A Frankenstein government is not possible," he told the Cadena Ser radio station.

"He (Sanchez) told me he would go into opposition, that he would not attempt any alternative government.

"I feel frustrated... as if I had been tricked."

Those who resigned Wednesday -- among them several so-called "party barons," or regional presidents -- will be hoping that if Sanchez is forced out and if Rajoy attempts to push a government through again, some Socialist lawmakers will abstain.

But they are up against an October 31 constitutional deadline, after which the king will have to dissolve parliament and call a third round of elections.

And many believe that grassroots party members do not want to see a government led by Rajoy come to power.

Sanchez -- the first Socialist party leader to be directly voted in by these grassroots members -- will be banking on this to help his cause.

- Like Corbyn coup -

The mass resignation bears striking similarities to the attempted coup against Jeremy Corbyn, the leader of Britain's opposition Labour Party.

In June, just days after Britain voted to exit the European Union, moderate Labour lawmakers proposed a no-confidence vote on the veteran socialist's leadership.

A string of his frontbench team then quit in coordinated fashion, each releasing withering resignation letters, before he was defeated by 172 to 40 in the non-binding vote of Labour lawmakers.

But Corbyn, who has the crucial backing of labour unions and was elected last year in a landslide by grassroots party members, survived and was voted back in as leader at the weekend.