Image copyright Jaume Clotet Image caption Catalan President Carles Puigdemont signed the bill into local law almost immediately

Parliament in Spain's restive Catalonia region has approved an independence referendum on 1 October which Madrid has vowed to outlaw.

Separatist parties which hold a slim majority backed the referendum bill allowing for a vote on whether the wealthy region should leave Spain.

Prime Minister Mariano Rajoy has asked the constitutional court to nullify it.

He was due to hold an emergency cabinet meeting on Thursday and meet other party leaders.

Image copyright EPA Image caption Catalan MPs celebrated after the vote

His deputy earlier accused secessionists of trampling on democracy.

Spain's wealthy north-eastern region already has autonomous powers but the regional government says it has popular support for full secession.

The Catalan government has a majority in the regional parliament made up of the separatist Junts pel Si (Together for Yes) coalition and the left-wing CUP party.

Flag protest

Catalan President Carles Puigdemont signed the bill into local law almost immediately after the vote, when it was adopted with 72 votes in favour and 11 abstentions in the 135-seat chamber in Barcelona.

When the outcome was announced, separatist MPs broke into the official national anthem of Catalonia, Els Segadors.

Image copyright AFP Image caption Spanish unionist MPs did not stay for the vote

Unionist MPs from the regional branches of Mr Rajoy's Popular Party (PP), the Socialist Party and the centrist Ciudadanos party had left the chamber in protest before the vote, which followed a marathon debate.

PP members left Spanish and Catalan flags on seats behind them to show their disapproval. However, when an MP from the leftist party Podemos started removing the Spanish ones, she was rebuked by the Speaker, Carme Forcadell.

The decision has plunged Spain into a national crisis only three weeks after jihadist attacks in the heart of Catalonia left 16 people dead and more than 100 others wounded.

Image copyright EPA Image caption The leaders of Spain and Catalonia demonstrated unity in the wake of the Barcelona attacks

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".

The war of words intensified when Catalan President Carles Puigdemont accused her of threatening and insulting all Catalans.

Will the vote go ahead?

The pro-independence Catalan government has been preparing for the 1 October vote for months. In its bill announced on Wednesday it said a Yes vote would be followed within 48 hours by a declaration of independence.

Image copyright Carme Forcadell Image caption Catalan parliamentary Speaker Carme Forcadell tweeted a photo of Wednesday' voting display

Mr Puigdemont says the smallest of margins above 50% will be enough.

So the Spanish government is doing all it can to prevent the vote from taking place. However, an earlier vote in November 2014 did go ahead even after Spain's constitutional court declared it was not an official referendum.

Was Tuesday's vote legal?

The constitutional court argues that Spain's constitution does not allow regions to unilaterally decide on sovereignty.

Former Catalan leader Artur Mas was barred from office by a court earlier this year for running the 2014 vote.

Under a 2015 law, Spanish public servants can be suspended by the constitutional court if they ignore its rulings. Carles Puigdemont insists his position is governed by Catalan regulations and sees any attempt to suspend him as unacceptable.

Other public servants could also be fined and hit by temporary suspensions if they help run the vote.

Catalan leaders have already acted to replace officials not seen as sufficiently supportive of the vote. The head of the region's Mossos d'Esquadra police force, Albert Batlle, resigned from his post over the summer.</s>The Latest on the Catalan parliament's vote to pave the way for an independence referendum (all times local):

Opposition lawmakers in Catalonia are contesting a decision by the head of the regional parliament to vote on a bill that paves the way for a controversial independence referendum.

The president of the Catalan parliament, Carme Forcadell, called for a recess in Wednesday's parliamentary meeting after heated discussions erupted following a last-minute decision to hold the vote on the so-called "referendum bill."

The referendum, planned for Oct. 1, would not be recognized by Spain's central authorities, who have vowed to use all legal measures to stop it.

Pro-independence Catalan lawmakers, who hold a majority in the regional parliament, want to vote on the bill after a 2-hour window for the opposition to introduce amendments. The opposition argues that the bill should be first vetted by a legal committee because it clashes with Spain's constitutional laws.

Catalan lawmakers are voting on a bill that will allow regional authorities to officially call an Oct. 1 referendum on a split from Spain, making concrete a years-long defiance of central authorities, who see the vote as illegal.

The so-called referendum bill was included at the last minute in the agenda of Wednesday's plenary meeting of the regional parliament, and is likely to be passed by a pro-independence majority later in the day, paving the way to formalize plans for the ballot.

The vote is not recognized by the Spanish government and most political parties at the national level. Prime Minister Mariano Rajoy has vowed to use all legal measures to ensure that it doesn't take place.

Catalonia is a prosperous region in northeastern Spain that already enjoys ample self-government.
A last minute presentation to the Parliament of Catalonia results in the formal approval of a referendum concerning independence from Spain after tense discussions. Though the country's president urges the government to ignore the bill, parliament is expected to vote in favor of an independence vote. For the approval of this law, the Speaker, Carme Forcadell breaks the regulations of the Parliament, placing the camera outside the law and violating the rights of the opposition.