Pablo Iglesias, leader of the hard-left party Podemos and a deputy prime minister in Spain's ruling coalition, said Monday he would resign from the government to run as Madrid's regional chief.

The announcement was a political bombshell with analysts agreeing it was a risky gamble for Iglesias: leaving national politics with no guarantee he will succeed in displacing the right in Spain's wealthiest region where it has held sway for 25 years.

"I have informed (Prime Minister) Pedro Sanchez about my decision to leave my post in government when the campaign begins," he said in a video message posted on social media referring to elections scheduled for May 4.

The pony-tailed former professor of political science took up his position as one of four deputy prime ministers in January 2020, leading Podemos into the government for the first time since it was formed in 2014.

Iglesias said current Minister of Labor Yolanda Diaz will replace him as vice-president of the government and as the party's candidate in the next legislative elections in 2023.

Speaking to reporters in Paris, Sanchez -- who has had a tense relationship with Iglesias -- wished him "good luck in his new political career" and acknowledged his "contribution" to Spain's coalition government, but did not confirm who would replace him in his role as second deputy premier.

Iglesias led Podemos into the ruling coalition in January 2020
Iglesias led Podemos into the ruling coalition in January 2020 POOL / Emilio Naranjo

Iglesias' announcement came a day after a regional court confirmed the snap election, which was called last week by the PP's Isabel Diaz Ayuso, who resigned as Madrid's regional leader.

An outspoken rightwinger with relatively little political experience, Diaz Ayuso called the election in an apparent bid to shore up political capital she has earned through resisting pressure to impose tighter virus restrictions on the local economy.

Early polls suggest she will secure a clear win, although with Iglesias entering the race, the regional elections in Madrid take on a national dimension.

Diaz Ayuso, who has led fierce opposition to the central government's pandemic restrictions, has framed the snap polls as giving voters a choice "between Socialism and freedom".

"Communism or freedom," remarked opposition leader and chief Pablo Casado in a sardonic response on Twitter just minutes after Iglesias' announcement.

The rightwing incumbent Isabel Diaz Ayuso has framed the elections as a choice 'between Socialism and freedom'
The rightwing incumbent Isabel Diaz Ayuso has framed the elections as a choice 'between Socialism and freedom' COMUNIDAD DE MADRID / Handout

Madrid's rightwing mayor Jose Luis Martinez-Almeida was even more derisive.

"Pablo Iglesias as a candidate? That's a sure-fire victory for Diaz Ayuso, without a doubt," he said.

"Pablo Iglesias is the worst-rated politician in Spain."

Analysts said the move raises the stakes for the May vote in Spain's wealthiest region.

"It's a strong play to try to displace Isabel Diaz Ayuso from the regional government," said analyst Paloma Roman.

As Spain's second deputy prime minister, Iglesias was "an important candidate", but also a "very strong and controversial figure, easily as controversial as Diaz Ayuso herself", she said.

"It could be a very polarised fight."

And it could also ease tensions within Spain's ruling coalition, she said.

There has been constant friction between the Socialists and Podemos since the coalition was formed in January 2020, notably over migrants, social policy, the state of Spain's democracy and most recently over violent protests triggered by the jailing of a rapper for controversial tweets.

"Perhaps the departure of Pablo Iglesias from the government itself will ease those tensions... because he won't be sitting with them in the cabinet," the analyst said.

A political scientist by training, Iglesias founded Podemos just over seven years ago, the party emerging from the anti-austerity "Indignados" protest movement that occupied squares across Spain in 2011 during the global economic crisis.

Bearded and with a solemn gaze, Iglesias was for years known for his long pony-tail, but since entering government, he has taken to wearing it up in a top-knot, or bun.