Image copyright Getty Images Image caption David Lidington was in Edinburgh for talks with Scottish government minister and advisors

A foreign office minister has cast doubt on the possibility of Scotland securing a special deal to remain part of the EU as the UK leaves.

Europe Minister David Lidington was in Edinburgh for talks with his Scottish government counterpart Fiona Hyslop.

He said there was a "clear legal position" that "we have to leave the EU".

First Minister Nicola Sturgeon said ruling out any options for Scotland would be "seriously premature".

Voters in Scotland backed remaining in the European Union by 62% to 38%, while the UK as a whole voted 52% to leave in a referendum on 23 June.

The Scottish government has pledged to study all possible options for the future - one could include a special deal allowing Scotland to retain access to the EU, another could be a second independence referendum.

'Best possible deal'

Asked if there was a way Scotland could remain in the EU, Mr Lidington said: "The legal position is very clear, we have to leave the EU, before you can apply to be a member again, and the Spanish government has made it very clear that they don't see this as a prospect.

"The important thing is that the Scottish government works very closely with the UK government to get the very best possible deal for Scotland and its people in the forthcoming negotiations."

When asked if Scotland's future relationship with the EU would be from the outside, he replied "yes".

Mr Lidington added: "I'm very sad about the result, but it has to be respected."

Ms Sturgeon said she would not read too much into Mr Lidington's comments, adding that there might not even be a Europe minister when the new UK government is set up following the Tory leadership contest.

The first minister said she remained of "the very firm view that Scotland voted to remain in the EU", and that her job was to make sure all options were considered to "achieve that outcome".

Image copyright PA Image caption Nicola Sturgeon said she would not read too much into Mr Lidington's comments

She said: "For anyone to rule out these options before they've been considered is seriously premature.

"We have no sense of how things are going to move forward. The complete lack of planning [from the UK government] has been exposed over the last few days.

"The fundamental point is that Scotland didn't vote to leave the EU. Scotland voted to stay in the EU and that should be our starting point of principle."

The first minister later tweeted BBC Scotland business and economics editor Douglas Fraser to underline her view that the legal position on Scotland remaining in the EU remains to be clarified.

Mr Lidington also met members of the first minister's Standing Council on Europe, as well as Scottish Conservative leader Ruth Davidson.

Ms Davidson said she had stressed the importance of the European single market to Scotland's economy, and the "over-riding priority" to retain access to it.

She added: "We both agreed that it is vital for the voice of Scotland to be heard in these talks, and that the Scottish government should be involved at all stages of the negotiations.

"Protecting our trade with the European Union will boost our economy, sustain jobs and help to fund vital public services."