The Spanish government would not block an independent Scotland from joining the European Union if the country’s exit from the UK was “legally achieved”, a senior diplomat has declared.

Miguel Angel Vecino Quintana, the Spanish consul general in Edinburgh, also insisted that his country would “never intervene in the internal affairs of the United Kingdom”.

He spoke out in the wake of reports which had indicated Spain could veto an independent Scotland from being part of the EU.

While First Minister Nicola Sturgeon and Scottish ministers have made plain their desire for Scotland to be part of the group of nations, Esteban Gonzalez Pons was reported to have said his centre-right Partido Popular (PP) would “veto an independent Scotland from directly entering the EU before Brexit”.

But in a letter sent to The Herald newspaper, which was also copied to Scottish Government officials, Mr Quintana insisted that the politician had been speaking “in his and his party’s exclusive responsibility” and not on behalf of the Spanish government.

A spokesman for the First Minister said: “This is welcome confirmation of the position taken by the Spanish government in relation to an independent Scotland’s place in the European Union, including the confirmation of the fact that this has always been their stance.

“There is huge goodwill towards Scotland from our European friends and neighbours, and as an independent country we will be well positioned to take our place as an equal partner.”

In the letter, which was released by the Scottish Government under Freedom of Information legislation, the diplomat told how Spanish minister for foreign affairs Josep Borrell had “recently declared that Spain will not block Scotland’s entry into the European Union if independence is legally achieved”.

Mr Quintana added that this “has always been the intention of the Spanish government”.

He continued: “The Spanish government has not and never will intervene in the internal affairs of the United Kingdom or any other state and expects the same reciprocal attitude.”

Mr Quintana also dismissed claims from opponents of independence that Scotland could have to wait to join the EU.

“Entry into the European Union does not depend at all in waiting in a queue like waiting in a shop for your turn to arrive,” Mr Quintana wrote.

He added: “The European Union is joined if the economic and political conditions required by all treaties that regulate it are fulfilled.”

Deputy First Minister John Swinney welcomed the letter, saying it “confirms the fact, as we have always known, that Spain would not block an independent Scotland from joining the European Union”.

And SNP depute leader Keith Brown described it as “a major intervention that puts a favourite anti-independence myth to bed once and for all”.

Mr Brown stated: “In 2014, Scotland’s EU membership was central to the No campaign’s message – they said, repeatedly and explicitly, that voting Yes meant leaving the EU and voting No meant staying.

“We now know that the exact opposite is the case – and Scotland is being dragged out of the EU precisely because we’re not independent.

“Scotland’s future belongs in Europe – and people in Scotland should have the chance to make that choice.”