Nationalists regained control of Catalonia‘s regional government as a new cabinet was sworn in, automatically ending just over seven months of direct rule from Madrid by Spain’s central government.

The cabinet led by Quim Torra, a close aide to former Catalonia leader Carles Puigdemont, took over on the day Socialist Pedro Sanchez, who has said he wants talks on Catalonia but opposes any independence referendum, was officially sworn in as new Spanish prime minister.

His predecessor, the conservative Mariano Rajoy, imposed direct rule over Catalonia at the end of October after nationalists, led by Puigdemont. held an independence referendum deemed illegal by Spanish courts.

According to the Spanish constitution, direct rule from Madrid was due to end the moment a new regional government was put in place in Barcelona.

According to the extraordinary powers granted to Spain‘s central government by the Senate, the large degree of self-rule enjoyed by the region would be returned once it formed a government after a new election.

It took several tense months, after snap regional elections were held in December, for Catalan nationalists to get a new cabinet approved by the regional parliament and go past Madrid’s moves to block any candidate in self-imposed exile or in jail.

Members of Catalonia’s former government are to be tried on charges including rebellion. Others, including Puigdemont, fled the country as fugitives.

The former Catalan leader is currently in Germany, where he is the subject of attempts by state prosecutors there to have him extradited to Spain.