Media playback is unsupported on your device Media caption Nicola Sturgeon: 'You can't stand in the way of the will of the Scottish people'

The SNP has increased its number of MEPs from two to three while Scottish Labour lost both its seats in the European elections.

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

The Brexit Party secured second place and has won one seat. The Lib Dems and Tories also won a seat each.

Labour came fifth with less than 10% of the vote - down from 26% in 2014.

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

The final Scottish tally was declared after the last council, Western Isles, declared its results late Monday morning.

The SNP came in a clear first with 37.7% of the vote followed by the Brexit Party with 14.8%. Next was the Lib Dems with 13.8%, after that the Conservatives with 11.6%. Labour recorded 9.3% of the vote and the Scottish Greens came in with 8%.

The final result 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 SNP's Alyn Smith, Christian Allard and Aileen McLeod have been elected MEPs

SNP leader and Scotland's First Minister, Nicola Sturgeon, was on an official trip to the Republic of Ireland when the final declaration was made.

Speaking from Dublin, she said that the outcome had shown that the "UK political system has failed - and it has failed Scotland utterly".

Ms Sturgeon added: "Scotland said no to Brexit in 2016. This result makes clear, we meant it.

"The message from Scotland today is that we will not accept a Brexit process that silences our nation, that treats our parliament and government with contempt and that fails to represent the interests of people in Scotland."

She pledged: "The SNP will continue working with other parties to stop Brexit and all the ensuing economic damage to Scotland."

Turnout up on 2014

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

The SNP won the biggest share of the vote in 30 of the 32 council areas, with the Lib Dems first in both Orkney and Shetland.

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.

At the last EU poll five years ago, UKIP won 10.4% of the vote in Scotland and secured one European seat. At this election its share of the vote dropped to 1.8%.

Turnout across Scotland was recorded at 39.9%, up from 33.5% five years ago.

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

Scottish Labour candidate David Martin, who had been an MEP since 1984 but has now lost 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."

Media playback is unsupported on your device Media caption Richard Leonard: "I am more and more compelled to believe that there should be a vote on whatever deal is facing parliament."

Labour politicians, MPs Ian Murray and Martin Whitfield, said it was "devastating" that Mr Martin had lost his seat.

In a strongly-worded joint statement, they suggested Labour may "never recover" after posting the worst results in the party's European elections history.

The pair blamed UK Labour leader Jeremy Corbyn, saying: "It is official Labour Party policy to support a People's Vote as a way out of this catastrophic mess, yet Jeremy Corbyn snubbed our membership and refused to embrace it. As a result he personally handed victory to Nigel Farage.

"As the hard right rises and the Tories tear themselves apart, Jeremy is squandering the opportunity to deliver a radical reforming government that so many millions of people urgently need."

Scottish Labour leader leader Richard Leonard - a close ally of Mr 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".

However, he told the BBC that he was "more and more compelled" to believe that there should be another vote on the UK's future in Europe.

Asked what vote he thought should be held, Mr Leonard said: "[It should be on] Whatever deal is facing parliament, whether that is a no deal Brexit, which would be catastrophic, or some variant of that."

Image copyright Getty Images Image caption The SNP topped the poll, returning three MEPs but Scotland also elected the Brexit Party's Louis Stedman-Bryce

Image caption Scottish Conservative leader Ruth Davidson attended the formal declaration of Scotland's EU election results

Image copyright Getty Images Image caption Sheila Ritchie, the newly-elected Lib Dem MEP, celebrated with party colleagues and supporters

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".

She said: "It was clear before the election the Conservatives were going to get a kicking across the UK for not delivering Brexit as promised.

"This election - to a parliament we were already supposed to have left - had a unique set of circumstances.

"That we held our seat in Scotland is primarily down to the hard work of our campaigning team and I thank each and every one of them."

She added that dividing the pro-Union vote only served to benefit the SNP.

'This is about stopping Brexit'

The Scottish Liberal Democrats recorded a 6.8% increase in their vote compared with five years ago and in the UK as a whole the party's vote share rose by 12.4% to 20%.

Lib Dem leader in Scotland, Willie Rennie, urged Ms Sturgeon not to interpret the SNP's success in the election as support for independence.

He said: "She's tried to say that people who voted remain in Scotland in the referendum have somehow indicated support for independence and she's misjudged that, she shouldn't misjudge this one as well.

"This is about stopping Brexit, that's the top priority, it's the crisis that is ahead of us and is why everybody needs to join together."

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

Analysis by BBC Scotland political reporter Philip Sim

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

It was also a decent night for the Brexit Party, who improved on UKIP's previous performance in Scotland and have taken 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.

Image copyright PA Image caption The SNP's Alyn Smith (centre) was returned to the European Parliament as one of his party's three MEPs

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 show 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 happened 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 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 have elected MEPs.

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

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