MADRID — Spain’s Supreme Court sentenced nine Catalan separatist leaders Monday to prison terms of between nine and 13 years on charges of sedition, a ruling that triggered immediate protests and a police response.

A 2017 referendum on Catalan independence, which Madrid deemed illegal, and the subsequent trial of those behind it have split Spanish society like no other events since the country’s democratic transition in the mid-1970s after the death of dictator Francisco Franco.

Catalan voters backed leaving Spain in the referendum, but low turnout and a lack of observers cast doubt on the legitimacy of the results.

In response to Monday’s ruling, separatist sympathizers in Catalonia vowed massive demonstrations in a rejection of the sentences. Police cordoned off streets and halted public transportation in Barcelona, the Catalan capital, as thousands of protesters marched at major transit hubs, including the city’s international airport. 

Catalan officials attacked what they considered harsh sentences, although all 12 defendants were acquitted of the more serious charge of rebellion. They called on the Spanish government to negotiate a different solution.

“We tended to think that this was something impossible in 20th-century Europe; now we see that it is possible,” Alfred Bosch, Catalonia’s minister for foreign action, institutional relations and transparency, told The Washington Post. “Political leaders were condemned to 100 years in jail because they held a vote,” he said, referring to the cumulative length of the sentences.

But the acting government in Madrid urged respect for the rule of law. 

Pedro Sánchez, Spain’s acting Socialist prime minister, defended the ruling and vowed that his government would “guarantee the complete fulfillment” of the sentences, a signal that he would not grant pardons as some on the right had anticipated. 

“In a social and democratic state of law, compliance means full compliance,” Sánchez told reporters. “This has been a judicial process with full guarantees and transparency.” 

“The government of Spain will work in the coming days toward guaranteeing public order and protecting our democratic laws as it has always done.”

At least one Catalan group said it would respect the court’s ruling. In a statement, the Catalan Civil Society urged local authorities “not to call for confrontation.” But others, such as FC Barcelona, one of the world’s most popular soccer teams, objected to the sentences. “Prison is not the solution,” the group said in a statement. 

Three other defendants were found guilty of disobedience, which means they will be fined but not serve prison time. The top Catalan officials were given longer sentences.

Spanish prosecutors initially sought a prison term of 25 years for Oriol Junqueras, Catalonia’s former vice president and the highest-ranking Catalan official on trial. Junqueras ultimately received 13 years, the longest sentence the court handed down.

After the ruling, Junqueras said Monday that Catalan independence was “closer than ever.” His comments were relayed by his Republic Left party. 

The Supreme Court’s ruling rejected the argument, widely circulated in Catalonia, that Spain violated civil rights by not honoring the results of the October 2017 referendum.

The court concluded that the central government had a clear right to protect Spain’s “territorial integrity” and questioned the democratic value of a vote called outside the law “without the slightest guarantees or transparency.” The court accused the Catalanleaders who staged the 2017 referendum of misleading a vulnerable public.

“They knew that a break with the state requires something more than a stubborn repetition of slogans directed to a part of the citizenry that trusts innocently in the leadership of their political representatives,” the court’s ruling read. “The political leaders and associates hid behind the imaginary right to self-determination to pressure the government into a negotiation for a popular vote.”

The court also dismissed claims that the accused were prosecuted for their political beliefs rather than their extralegal actions, pointing out that pro-independence political parties already participate in regional and national parliaments. But the ruling did not convince a number of Catalan leaders, including Carles Puigdemont, the principal architect of the 2017 referendum. 

“A total of 100 years of prison. How horrible. Now more than ever, we will be with you and your families. For the future of our sons and daughters. For democracy. For Europe. For Catalonia,” Puigdemont, a former regional president of Catalonia, said in a statement on Twitter. He fled to Belgium after calling the 2017 referendum. 

Spain on Monday renewed its extradition request for Puigdemont.

The ruling looks set to play a role in Spanish elections in early November, the fourth vote the country has held in four years. Sánchez was unable to form a government after winning a general election in April, largely because of a standoff with smaller parties on the far left and political center. 

Political analysts viewed the vote in the context of Spain’s mounting political fragmentation. There are two political parties in the Spanish parliament that support Catalan independence, and it was unclear how the verdict in the Catalan trial would affect the upcoming election. 

“It’s either going to get the pro-independence political parties more votes, or people will come to the conclusion that we’ve been through this now, we have a sentence, and they won’t get votes,” said William Chislett, an analyst at the Elcano Royal Institute, a Madrid think tank.

“Which way it’s going to go is anybody’s guess,” he said.

McAuley reported from Paris.