Brussels (AFP) - The EU on Thursday warned that Catalonia would automatically drop out of the bloc and would have to apply for re-admission if it seceded from Spain.

"If part of a member state ceases to be part of that state, because of the territory becoming an independent state, the (EU treaties) would no longer apply to that territory," European Commission spokesman Margaritis Schinas said when asked about the possible consequences of a September 27 regional vote in Catalonia.

"A newly independent region by the fact of its independence would become a third country in respect of the EU and may apply to become a member of the Union," Schinas told reporters in Brussels.

He said this position was first spelled out by then European Commission head Romano Prodi in 2004, a time when the bloc was welcoming in several new members from eastern Europe.

The position was repeated on many occasions since, Schinas said, recalling that current Commission president Jean-Claude Juncker had done so most recently in 2014.

The same question was asked in the run-up to Scotland's referendum on independence from Britain a year ago, with the Commission sticking exactly to the same script.

A think tank close to Spain's opposition Socialist Party, the Fundacion Alternativas, said in a study published on Thursday that for Catalonia to secede against Spain's will would breach European law.

"A unilateral declaration of independence, in contravention of the Spanish constitution and (European) treaties, would make it practically inviable for Catalonia... to be admitted into the Union" and to open fresh accession negotiations once it had seceded from Spain, the foundation wrote.

Last week, there were massive pro-independence protests in Catalonia ahead of regional polls which Catalan leaders are casting as an indirect vote on breaking away from Spain.

Polls show a majority of Catalans are in favour of a referendum but they are almost evenly divided on independence.

Story continues

Spanish Prime Minister Mariano Rajoy fiercely opposes independence and has said he will do everything possible to prevent it.

Scottish voters opted to remain in the United Kingdom after British Prime Minister David Cameron promised to hand over more powers, including rights to tax.

The prospect of Catalonia's independence poses a similar problem for NATO, with Spain an important and strategically located member of the US-led military alliance.

A NATO official told AFP: "A territory that breaks away from a NATO member state would not be able to stay automatically as a member of the alliance."

"It would have to follow the existing procedures in case it wants to apply for NATO membership."

Alliance member states also have the right to invite another country to join but this must be by "unanimous agreement," the official added.