Image copyright Getty Images Image caption The flag currently occupies the third superior position outside the parliament

The European Union flag is to be taken down outside the Scottish Parliament when the UK leaves on 31 January, it has been confirmed.

Former Europe minister Alasdair Allan was campaigning for the flag to stay up to mark Scotland's 62% vote for Remain.

But the parliament's management group has confirmed that it will come down.

Presiding Officer Ken Macintosh told MSPs that the Council of Europe Flag will be flown on Europe Day "as a mark of our continued ties with that body".

The flag will be lowered at 23:00 on 31 January, at the moment the UK officially leaves the EU.

Mr Allan had submitted a parliamentary motion saying that parliament "should continue to fly the EU flag on its grounds, in line with the democratic decisions of Scotland's voters and MSPs to remain in the EU".

This was backed by a number of his SNP colleagues and some Greens, but has now been dismissed by the parliament's cross-party corporate body management group.

Mike Russell, the Scottish government's Brexit secretary, later tweeted that the decision was "wrong and needs to be changed". It is understood the government could attempt to overturn the decision.

An email from Mr Macintosh to all MSPs said the group had agreed that "from 11pm on 31 January the Scottish Parliament will no longer fly the EU flag on a daily basis".

He added: "The corporate body decided that on Europe Day we shall fly the Council of Europe flag as a mark of our continued ties with that body and that our flag-flying policy should be amended to reflect these decisions."

Image caption Ken Macintosh insisted the decision to take down the flag was "non-political"

After Mr Allan asked in a point of order if the move could be challenged by MSPs, Mr Macintosh insisted it was a "non political decision".

He said: "The corporate body discussed this at length and was very aware of the political sensitivities or the feelings of members of this chamber and of Scotland generally.

"There is a huge amount of symbolism and politics in flag-waving and flag flying. The corporate body takes decisions in the interest of the parliament, not in the interest of any party.

"It is a neutral and trusted institution, and the members of the corporate body were very aware of the need to do so, and not to take a political decision on this matter."