Socialist Pedro Sanchez has taken over as Spain's prime minister, after outgoing leader Mariano Rajoy lost a parliamentary confidence vote triggered by a long-running corruption trial involving members of his party.

Mr Sanchez becomes Spain's seventh prime minister since its return to democracy in the late 1970s following the dictatorship of Francisco Franco.

Mr Rajoy's departure after six years in office casts one of the European Union's top four economies into an uncertain political landscape, just as another - Italy - pulled back from early elections.

Mr Sanchez won today’s no-confidence motion with 180 votes in favour, 169 against and 1 abstention.

He suggested on Thursday that he would try to govern until the scheduled end of the parliamentary term in mid-2020.

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

But it is unclear how long his administration, with only 84 Socialist deputies in the 350-member legislative assembly, can last.

With most Spanish parties and Mr Sanchez himself being pro-European, investors however see less broader political risk there than in Italy.

Anti-establishment parties in Rome revived coalition plans on Thursday, ending three months of turmoil by announcing a government that promises to increase spending, challenge European Union fiscal rules and crack down on immigration.

Many observers have said Mr Sanchez is unlikely to call any vote until after European, local and regional elections take place in May next year.

He has already committed to respecting a budget passed by Mr Rajoy, and the fragmented parliament means he will find it hard to row back on structural reforms passed by his predecessor, including new labour laws and cuts in healthcare and education.

Leftist Podemos, which will offer parliamentary support to Mr Sanchez's government, is also unlikely to gain big influence over the new prime minister, who is keen to differentiate his Socialist party from its anti-austerity ally and win back centrist voters.

Mr Rajoy had conceded defeat prior to the no-confidence vote, earlier telling deputies: "Mr Sanchez will be the head of the government and let me be the first to congratulate him."

His position had become increasingly untenable, undermined by his status as head of a corruption-tinged minority government as well as a divisive independence drive in the wealthy region of Catalonia.

The Basque Nationalist Party, whose five seats were key to Mr Sanchez securing enough parliamentary backing, withdrew support from Mr Rajoy after dozens of people linked to his centre-right People's Party (PP) were sentenced to decades in jail in a corruption trial.

Ciudadanos, leading in the national opinion polls, was the only major party that supported Mr Rajoy.

Two Catalan pro-independence parties as well as Podemos backed Mr Sanchez.

He is expected to be sworn in by Monday and appoint his cabinet next week.

Mr Sanchez has promised to start talks with the Catalans but has said he will not give the region an independence referendum.

Meanwhile, Catalan authorities have announced their new cabinet, excluding four nominees under investigation for their part in the independence drive to pave the way for Madrid to end its direct rule.

Elsewhere, German prosecutors have made a court application for the extradition to Spain of the leader of the independence movement, former regional president Carles Puigdemont, on charges linked to his role in the campaign.

Mr Puigdemont was detained in Germany in March on a European arrest warrant.