BARCELONA, Spain — In a major escalation of Spain’s territorial conflict, the Spanish Senate on Friday authorized the government to take direct control of the fractious region of Catalonia, just after Catalan lawmakers declared the region’s independence.

The dueling actions set up a potential showdown over the weekend, as Spain careened into its greatest constitutional crisis since it embraced democracy in 1978.

The Senate voted 214 to 47 to invoke Article 155 of Spain’s Constitution, granting Prime Minister Mariano Rajoy a package of extraordinary powers to suppress Catalonia’s independence drive. The measure will go into effect after it is published in the government register, which is expected to happen Friday night.

In a speech on Friday before the vote, Mr. Rajoy had said he had “no alternative” because the Catalan leader, Carles Puigdemont, and his separatist cabinet had pursued an illegal and unilateral path that was “contrary to the normal behavior in any democratic country like ours.

Undeterred by the government’s threat, and after a bitter debate, separatists in the Catalan Parliament passed a resolution to “create a Catalan republic as an independent state.” Lawmakers opposed to independence walked out of the chamber in protest before the vote.

Mr. Puigdemont came close on Thursday to calling early regional elections, but dropped the idea and instead told Catalonia’s Parliament that it would make a decision on independence the next day. He leads a fragile separatist coalition that has 72 of the body’s 135 seats

During the debate that preceded the vote, Catalan lawmakers traded accusations and in turn described the occasion as “historic” and “happy,” or else “tragic” and a serious violation of Spain’s Constitution.

Addressing the Catalan Parliament in Spanish, Carlos Carrizo, a lawmaker from Ciudadanos, a party that opposes secession, told Mr. Puigdemont and separatist lawmakers that, far from creating a new Catalan republic, “you will go down in history for having fractured Catalonia and for sinking the institutions of Catalonia.”

In front of the assembly, he tore apart a copy of the independence resolution. “Your job is not to promise unrealizable dreams but to improve the daily lives of people,” he said.

Before the independence vote, Marta Rovira, a separatist lawmaker, told the assembly that “today we start on a new path” to build “a better country.” She added: “We are creating a country free of repression.”

Catalan lawmakers who voted for independence could face prosecution for sedition, or even rebellion.

Marta Ribas, a Catalan lawmaker, said that Madrid’s use of Article 155 was unjustified, but also argued that “it’s a mistake to respond to one outrageous act with another outrageous act.” She added: “A declaration of independence won’t protect us from the 155, quite the contrary.”

In the streets outside Parliament in Barcelona, not far from a boisterous pro-independence rally, a few Catalans quietly expressed similar frustrations.

The Oct. 1 referendum did not give the Catalan government the legitimacy to vote to secede, said Federico Escolar, 53, a cafe owner.

“Most of the people who would have voted no did not participate,” Mr. Escolar said while smoking a cigarette outside his cafe. “It was not a proper referendum. It was illegal.”

Walking into a nearby subway station, Christina Juana, a 38-year-old social worker, agreed.

Mr. Puigdemont’s government has been flouting Spain’s Constitution since early September, when separatist lawmakers voted to hold a binding referendum on independence on Oct. 1 as a key step toward statehood.

Catalans who went to the polls voted overwhelmingly to approve independence, but the referendum took place without legal guarantees and with most opponents of independence staying away.

Before the Catalan Parliament’s vote for independence on Friday, large crowds had gathered outside in anticipation of what they hoped would be a historic day for Catalonia.

Many were draped in flags as they watched the parliamentary debate on two large screens, cheering during speeches by pro-independence lawmakers and hissing those of their opponents. When proceedings hit a lull, the crowds cycled through a series of pro-independence chants.

“Spanish occupiers!” was one, a reference to the national police officers who tried to stop the Oct. 1 referendum by force. “Leave Catalonia!”

Given the rhetoric of the Catalan leaders and the Spanish government both during the run-up to the independence vote and in the weeks thereafter, the fact that things have come to this point is hardly a surprise. On the one side, Puigdemont and his fellow ministers have essentially hinged their political futures on the idea of Catalan independence. Backing down now would be political suicide and would likely not avoid the potential legal consequences that they are likely to face should Madrid take steps to have them arrested and charged with sedition as has been threatened. Additionally, these leaders appear on the surface at least to be true believers in the cause of independence rather than merely political opportunists as many in Madrid may be assuming they are. On the other side, Prime Minister Rajoy can hardly afford to back down at this point either. He is the head of a minority government who could easily be removed from power should the coalition he put together collapse, as it easily could if he mishandles a crisis that appears on the surface at least to involve the unity of the Spanish state in a region that has been a historical part of what eventually became Spain since the 12th Century. At this point, he cannot afford to back down, or to fail, because it would essentially mean political disaster for him and his political party. Thus, Spain is left with a situation where Madrid and Barcelona are on a collision course and the outcome is far from clear.

Spain’s public prosecutor had previously threatened that charges of treason would be prepared against Mr Puigdemont and his government if independence were declared.

The Spanish government has said that the “first measure” it will apply under the special powers of Article 155 will be to take direct control of Catalonia’s security forces.

This could be crucial in the event that force is required to make direct rule effective, especially if tens of thousands of pro-independence supporters take to the streets.

On Friday, Spanish media quoted the public prosecutor as saying that the speaker of parliament, Teresa Forcadell, and members of her committee could also be accused of crimes against the state for allowing the vote to go ahead.

The Catalan parliament’s legal advisors warned that the proposal to form a republic was illegal.

On Friday afternoon, a Spanish government spokesman said the country’s top prosecutor was pursuing rebellion charges against those responsible for the Catalan parliament vote.

Under Spanish criminal law, rebellion can be punished with up to 25 years in prison, with shorter term penalties if the act of rebellion doesn’t lead to violence.

The article quoted above goes on to note that the main Catalonian independence group is calling for “peaceful resistance” to the actions that Madrid may take against Catalonian officials in the wake of the independence declaration, but its unclear whether those calls will be heeded or how long it will last if the central government tries to replace local security forces with forces from other parts of Spain. In that case, one important question will be how the security forces in Catalonia will choose to react. If they decide to side with the government and the civilian protesters, even in a limited way, then we could end up seeing that peaceful resistance descending into violence at least between local and national security forces, a move that could lead to the central government bringing in greater force to take control of the region. That’s a battle that Madrid is likely to win at least in the short term, but it’s one that isn’t like to stay non-violent for long. Ideally, cooler heads would prevail here and the two sides would sit down and try to hammer out some kind of compromise that results in greater regional autonomy within a united Spain. That, however, is something that would have seemingly been easier before the passions of independence were stoked by the leadership in Barcelona. With those passions having been stoked, it’s going to be hard to put out the fire before it causes some real damage.

I suppose I shouldn’t be surprised, but it’s a bit disheartening to read an analysis of the situation that focuses exclusively on the political career consequences of the possible outcomes to the principals on each side, and not at all on the actual merits of either side’s position or the underlying issues that have led to this situation.

I do have to admit to a bit of crogglement at having a referendum characterized as “contrary to normal behavior in any democratic country”. You can argue that it wasn’t properly done, but it doesn’t get any more democratic than referenda.

Apparently the Spanish constitution does not allow secession and Article 155 vaguely allows the national government to deal with it. But is there anything the national government could do to allienate the Catalans that they have left undone?