BARCELONA (Reuters) - The Catalan parliament voted in a hard-line separatist as leader on Monday, heralding an end to seven months of direct rule from Madrid but also more political uncertainty in a region that retains a mandate to seek a split from Spain.

The election of Quim Torra as regional leader will allow the wealthy region to run its own affairs for the first time since October, when Madrid imposed direct rule after sacking the previous administration after it declared independence.

It should also lead to Spanish Prime Minister Mariano Rajoy securing the backing he needs from regional parties to implement much-delayed central government budget plans. But it is unlikely to ease tensions between Madrid and Barcelona.

The deeply-divided Catalan parliament voted 66 in favor, 65 against and 4 abstentions for the election of Torra, a former lawyer and publisher with little political experience. The simple majority was what he needed to be voted leader after failing to get an absolute majority in a ballot on Saturday.

Following the vote, pro-independence lawmakers stood to sing the Catalan anthem. Torra, who was hand-picked as candidate by former regional leader Carles Puigdemont, then embraced members of parliament who formed a line to congratulate him.

Many wore yellow ribbons in honor of Catalan politicians held in custody in jail for their role in October’s illegal independence referendum.

In a speech to parliament on Saturday, Torra promised to work towards a Catalan republic and referred to Puigdemont, who is in Berlin waiting for a German court to rule on an extradition request from Spain, as the legitimate leader of the region.

Slideshow ( 8 images )

The Spanish government called the speech confrontational and a member of the Catalan parliament for Rajoy’s People’s Party (PP), Andrea Levy, said on Monday in a television interview that Madrid would apply direct rule again if the new administration overstepped the law.

Fearing an investor backlash, over three thousand companies have moved their registered headquarters out of Catalonia since October, while tourism also dipped after the referendum.

But over the whole of 2017, visitor numbers to Catalonia rose and its economy grew strongly, out-pacing the Spanish regional average.

Police sealed off part of the park surrounding the Catalan parliament in central Barcelona for the vote, but streets were quiet with no demonstrations.

“It’s essential that we put an end to direct rule from Madrid and for that reason alone this is definitely good news,” said 33-year-old actor Sergi Cervera, waiting outside an office building near the city’s famous Las Ramblas boulevard.

Under the terms of the legislation that allowed for Madrid to take over the regional government, direct rule will be lifted once the new administration has been formed with all cabinet members named.

Pro-independence parties won a majority of seats in regional elections called in December by Rajoy. However, the party that won the most votes was Ciudadanos (“Citizens”), which favors unity with Spain.