CATALONIA’S separatists have struck a last-minute agreement to form a new regional government that will work towards independence from Spain, with controversial secessionist leader Artur Mas stepping aside to seal the deal.

“Together for Yes and the CUP have reached a deal to form a government and this will not go to (new) elections,” a senior regional government source said.

“There is an agreement. We will have a government and stability,” Jordi Sanchez, president of the pro-independence Catalan National Assembly group, said on Twitter.

In September, Mas’ “Together for Yes” secessionist alliance and the more radical, far-left CUP party together won a majority of seats in the 135-seat parliament in the wealthy, 7.5-million-strong northeastern region.

But the honeymoon was short-lived as “Together for Yes”, which won 62 seats, battled with the CUP to form a government over the issue of Mas’ leadership.

Despite more than three months of intense negotiations, the small party that got 10 seats refused to give Mas their backing, resenting the austerity measures he implemented and corruption scandals linked to his party.

If a deal had not been reached by midnight on Sunday, Mas would have had to call fresh elections, which would have come as a major setback for the region’s independence drive.

He told a press conference overnight that he was stepping aside in order to strike the agreement with the CUP.

“I am stepping aside and will not be standing as a Together for Yes candidate for the re-election of president of the regional government,” he said.

Replacing him as candidate will be Carles Puigdemont, head of the association of pro-independence municipalities, Mas added.