Image copyright Getty Images Image caption The SNP's Alyn Smith will return to the European Parliament as one of his party's three MEPs

The SNP is on course to increase its number of MEPs from two to three in the European elections amid a collapse in support for Scottish Labour.

With 31 of the 32 Scottish council areas having declared their results, the SNP has 37.9% of the votes - up from 29% in the last EU election.

Nigel Farage's Brexit Party has the second most votes and will have one MEP, as will the Lib Dems and Tories.

Labour is fifth with just 9.3% of the votes - down from 26% in 2014.

It means Labour will lose both of its MEPs in Scotland, including David Martin who was the UK's longest serving elected EU politician.

The Western Isles will not declare its result until later on Monday, but it is unlikely to affect the overall Scottish result which is expected to be declared around noon.

The Brexit Party is currently on 14.7% of the votes in Scotland, with the Liberal Democrats on 13.9% and the Conservatives on 11.7%.

It means Scotland's six new MEPs will be;

the SNP's Alyn Smith, Christian Allard and Aileen McLeod

Louis Stedman-Bryce of the Brexit Party

Sheila Ritchie of the Liberal Democrats

and Baroness Nosheena Mobarik of the Conservatives.

Image copyright Getty Images Image caption The Brexit Party's Louis Stedman-Bryce will represent Scotland at the European Parliament

SNP leader Nicola Sturgeon, the country's first minister, tweeted that her party had won a "historic" victory in the election, and that Scotland had "rejected Brexit again".

The party's previous best European election result was 32.6% in 1994.

The SNP won the biggest share of the vote in 29 of the 31 council areas to have declared so far, with the Lib Dems first in both Orkney and Shetland.

At the last EU poll five years ago, UKIP won 10.4% of the vote in Scotland and secured one European seat. Prior to the final declaration this time, its vote share stands at 1.8% with the new Brexit Party winning 14.7% and on course to sending one MEP to Brussels.

Turnout across Scotland is currently 39.7%, up from 33.5% five years ago.

The election was held on Thursday in the UK, but the results could not be announced until after 22:00 on Sunday because voting was being held in other EU countries.

The SNP fought its election campaign on a strong anti-Brexit platform, with leader Ms Sturgeon urging voters to back her party to show "Scotland's for Europe".

The Liberal Democrats, whose vote is up across the UK, and the Scottish Greens also campaigned against Brexit and have joined the SNP in calling for another referendum on EU membership.

The SNP's Mr Smith, who tops the party's list for the election, said it was clear from the results that Scotland was a "different country" to the rest of the UK - where the Brexit Party is on course to win the most votes.

A modern browser with JavaScript and a stable internet connection is required to view this interactive. Click here for full UK results Find out who was elected in your area Search postcode, country or region (eg Scotland or West Midlands) The results for your area are not in yet * Votes counted as first preference. Vote share figures not included because of the STV electoral system Find out more about elections in Northern Ireland

Mr Smith told BBC Scotland: "It is clear that Scotland is for Europe, we have voted Remain again, and that vote cannot be ignored.

"People are voting SNP for a variety of reasons - there are those who are lending us their vote and others who are diehard SNP voters, we've got people coming to us from all over the spectrum.

"This has been about proving to the UK that we want to remain (in the EU)".

Scottish Labour candidate David Martin, who had been an MEP since 1984 but will now lose his seat, said his party's woes in the election were because "we didn't have a clear position" on Brexit.

He added: "Our message clearly should have been that Labour is a remain party."

Image copyright Getty Images Image caption Labour lost both of its MEPs, including long-serving David Martin

But party leader Richard Leonard - a close ally of Jeremy Corbyn - insisted that Labour had been the only party fighting to unite the country against "the divisions caused by the competing nationalisms of the UK and Scottish governments".

Meanwhile, Scottish Conservative leader Ruth Davidson said her party had retained a Scottish MEP on what was a "tough night for the party UK-wide"

The SNP and Labour both won two seats in Scotland in 2014, with the Conservatives and UKIP winning one each.

Image copyright PA

Who's had a good night and who's had a bad one?

Analysis by BBC Scotland political reporter Philip Sim

To take the easy questions first, it has been a good night for the SNP, who have gained a seat while cruising ahead of all of its rivals. There were council areas where the party was comfortably 30 percentage points clear of their nearest rivals.

It was also a decent night for the Brexit Party, who improved on UKIP's previous performance in Scotland and look set to take a seat. See also the Lib Dems, who say they "are finding votes from places we have never been before".

But for every winner in politics, there's a loser. Other than the SNP's dominance, the big story of the night was Labour's utter collapse, losing both of their seats.

The official line from Labour is that they're being punished by a "polarised" political climate. Others in the party are more direct - calling it an "absolute catastrophe" and "unforgivable".

Does this tell us anything about future elections, or the fate of Brexit? That's a much harder question.

Yes, unambiguously pro-EU parties did well - although of course they were always expected to, in a country that voted 62% for Remain in 2016. The SNP in particular are keen to proclaim that the results shows that "Scotland's not for Brexit".

The strong performances from the Brexit Party and the Lib Dems also underline the importance of having a clear constitutional position in an election that was all about sending a message.

But while turnout was up on previous European elections, it was still low by comparison with almost every other vote held in Scotland over the last 20 years. Less than half of the electorate registered a vote.

These results might not be replicated in any future Westminster or Holyrood election. But they will certainly shape the context of the debate in the coming months, at a pivotal time in politics.

What's happening elsewhere?

Image copyright Reuters Image caption Nigel Farage's Brexit Party is on course to win the most votes across the UK

Voting took place across the UK against the backdrop of Brexit, with both the Conservatives and Labour suffering big losses across the UK and the former heading for less than 10% of the vote.

The Brexit Party was the clear winner, with the pro-EU Lib Dems coming second.

Brexit Party leader Nigel Farage said the two main parties "could learn a big message" from the results.

All 28 EU member states are electing MEPs, and countries have been voting since Thursday.

Voters across the UK will choose a total of 73 MEPs in 12 multi-member regional constituencies, with Scotland classed as a single constituency that will elect six MEPs.

MEPs are elected in order as listed by their party, based on the parties' total share of the vote in each region.