Catalonia's parliament has sworn in a new separatist leader who has pledged to continue the region's battle for independence from Spain.

Catalan MPs elected Quim Torra, 55, as president by the narrowest of margins - 66 votes to 65.

The vote had been blocked for nearly five months - yet it remains unclear when Spain will lift its direct rule over Catalonia.

Spain's Prime Minister Mariano Rajoy has offered talks with Mr Torra.

The prosperous region has been under Madrid's direct rule since the Catalan separatists held a referendum in October and declared independence unilaterally - moves declared illegal by Spain.

Separatist leader Carles Puigdemont and five of his allies fled Spain during the crackdown and remain in self-imposed exile. Four others are in pre-trial detention, and 25 in total face charges of rebellion, sedition and corruption.

Addressing the parliament on Monday, Mr Torra said "Carles Puigdemont is our president".

He said he would "implement the mandate from the October referendum". He said his new government would "build an independent state in the form of a republic".

Unionist leader Ines Arrimadas of the anti-independence Ciudadanos party called Mr Torra a mere "puppet for Puigdemont".

Mr Puigdemont nominated Quim Torra on Thursday as a candidate for Catalan president, in a video from his self-imposed exile in Berlin.

Mr Torra has been criticised by opponents for writing what some have called an inflammatory article in 2012, in which he said some Catalans from Spanish-speaking backgrounds were "animals in human form who spew out hate".

Mr Torra worked as an executive for a multi-national insurance company, before he entered politics by joining the pro-independence civil society pressure group Òmnium Cultural.

He also ran a publishing company, dedicated to publishing works of Catalan literature and journalism.