Parliament in Spain’s prosperous Catalonia region has approved an independence vote for October 1, which Madrid has vowed to stop.

Separatist parties, which hold a slim majority, backed the referendum legislation and legal framework needed to set up an independent state.

Spanish Prime Minister Mariano Rajoy ordered government lawyers to file a complaint with the country’s constitutional court in hopes of annulling the referendum.

Polls in the northeastern region show support for self-rule waning as Spain’s economy improves. But the majority of Catalans say they do want the opportunity to vote on whether to split from Spain.

The vote will come about three weeks after Barcelona and a nearby town were struck by Islamist attacks that killed 15 people.

Deputy Prime Minister Soraya Sáenz de Santamaría condemned the Catalan leadership for carrying out “an act of force” and for acting more like “dictatorial regimes than a democracy.”

“What is happening in the Catalan parliament is embarrassing. It’s shameful,” she told reporters.

But Catalan leaders have pledged to proclaim a new republic within 48 hours if the “yes” side wins, regardless of turnout.

Former Catalan President Artur Mas said pushing ahead with the referendum was justified because a pro-independence coalition won the 2015 regional election.

“The referendum is what we have to do because we have the mandate of the peoples of Catalonia,” Mas said.