Catalonia’s regional parliament has elected pro-independence supporter Quim Torra as president, ending months of political stalemate in Spain’s northeastern region.

A close ally of former Catalan leader Carles Puigdemont, Torra, 55, won the ballot by a simple majority on Monday with the backing of 66 parliamentarians and four abstentions. Sixty-five legislators voted against him.

Torra has promised to draft a constitution for a future Catalan Republic and restore regional laws that were suspended by Spanish courts in the wake of Catalonia’s October 1, 2017, independence referendum in which about two million Catalans voted to secede from Spain.

Torra failed to win a prior ballot – which had required an absolute majority – on Saturday in the 135-member Catalan parliament, falling short of the 68 votes required to be elected.

Currently, 70 legislators in the regional parliament are pro-independence, and 65 are not.

‘Honourable president’

Puigdemont, who handpicked Torra for the presidency, described him as “very honourable” in a tweet on Monday following the parliamentary vote.

“Congratulations very honourable president… Culture and freedom, and democracy. All my love and support with immense thanks. Long Live Catalonia,” Puigdemont said.

The former leader is currently in self-exile in Germany and faces jail if he returns to Spain.

Other Catalan politicians, including Jordi Sanchez, are being held in Spanish prisons, charged with rebellion for their role in the independence drive.

Catalonia has been in political limbo since Spain’s central government sacked Puigdemont and his cabinet and imposed direct rule on the semi-autonomous region after it unilaterally declared independence on October 27 following the controversial referendum.

Regional elections were held in December, during which pro-independence parties won a majority of seats in the Catalan parliament, but five attempts to elect a new president and form a coalition government since then have failed.

Spanish Prime Minister Mariano Rajoy has warned that Article 155 of the constitution, which Madrid used to impose direct rule on Catalonia, “could be used again if necessary” if the region’s next government does not adhere to Spanish law.

Following Torra’s election, Rajoy called for “understanding and harmony” but reiterated that Spanish law under the country’s 1978 constitution would be “fulfilled”.