The new leader of the regional government of Catalonia told lawmakers on Sunday that he would carry out a plan to separate the region from the rest of Spain.

Hours before being formally confirmed as leader, Carles Puigdemont told the regional Parliament, "I am fully aware that we are starting a process that is far from easy and far from comfortable, but we will put into it value and courage." He added: "This isn't a time for cowards, nor for rashness, nor for renunciations."

Mr. Puigdemont is unexpectedly taking center stage after an 11th-hour agreement between Catalan separatist parties on Saturday to replace Artur Mas as the region's leader. The agreement was to be confirmed in a parliamentary vote later on Sunday, ending over three months of feuding among the parties.

"A few hours ago, I was mayor of Girona and I had not thought that I could be here today in the situation in which I find myself," Mr. Puigdemont said. "Sometimes one has to take on responsibilities that weren't those one imagined."

Mr. Mas stepped aside after failing to persuade the far-left party Popular Unity Candidacy — known by its Catalan acronym, CUP — to allow him to stay in office following regional elections on Sept. 27. A separatist coalition won the elections but without enough parliamentary seats to form a new government without the support of CUP lawmakers.

The CUP, however, insisted that it would not agree to another Catalan government led by Mr. Mas, whom it faults for imposing austerity cuts, as well as for failing to acknowledge corruption within his party, Convergence. Mr. Mas would have been forced to call new elections if no government deal had been struck by Sunday.

Despite their leadership disagreements, the separatist parties had already approved a resolution in November that calls for Catalonia to become an independent republic, a goal that separatists aim to achieve within 18 months. Most controversially, the resolution included a defiant claim that Catalan's march toward nationhood need not be subject to approval by the national government of Prime Minister Mariano Rajoy and other Spanish institutions, even the Constitutional Court.

Mr. Mas converted himself into the leader of the Catalan secessionist drive in 2012 after a fallout with Mr. Rajoy over whether Catalonia should be granted more tax benefits, as part of a Spanish fiscal system that redistributes tax income from richer regions like Catalonia to poorer ones.

Even if the territorial dispute had appeared to have turned into a personal fight between Mr. Rajoy and Mr. Mas, who are both conservative politicians, the removal of Mr. Mas is unlikely to help resolve what has become the biggest political headache for the government in Madrid.

In fact, while Catalonia is now putting an end to months of government deadlock, the deal there comes as Spanish politics enters a period of major uncertainty over who will lead the next government. Mr. Rajoy faces a struggle of his own to stay in office, after inconclusive national elections in December in which his Popular Party won the most votes but lost its parliamentary majority. Spain's new Parliament is set to convene on Wednesday.

Mr. Puigdemont, 53, made no reference in his speech on Sunday to the turmoil in national politics. He is a former journalist who became mayor of Girona in 2011 and has also been at the helm of an association of Catalan municipal leaders who favor independence.

The Spanish government responded on Saturday to the Catalan deal by issuing a statement in which it reminded the region's politicians that they had to respect Spanish law and decisions made to stop the secessionist drive. "There's no parliamentary majority that can promote or justify illegal acts and, even less so, pretend to break up the national sovereignty," the government said.

Mr. Mas said he had made a painful decision but insisted that he would remain in politics, even if no longer in a government leadership role. In his parliamentary speech on Sunday, Mr. Puigdemont thanked Mr. Mas for leading Catalonia toward independence and for making the "exemplary" decision to step aside in order to break the government deadlock. He also asked citizens for forgiveness for the three months of haggling over the future role of Mr. Mas.

Still, Catalan parties that oppose secession and the appointment of Mr. Puigdemont criticized the leadership agreement. Inés Arrimadas, a leading lawmaker from the Citizens party, described the deal among separatist parties as "a democratic fraud." She also told lawmakers on Sunday that Mr. Puigdemont was not "a person sufficiently moderate and respectful to represent all Catalans."