Image caption MSPs are expected to vote to voice support for the UK remaining in the EU

The Scottish Parliament has formally backed the case for the UK remaining in the European Union.

A debate in the Holyrood chamber saw leaders from all five parties speak in favour of Remain.

Ministers said they wanted to send a "clear, unequivocal" message of the parliament's support for EU membership ahead of the referendum on 23 June.

But there were a small number of dissenting voices from the Conservative and Labour ranks.

Members voted overwhelmingly to support a motion backing a Remain vote, by 106 votes in favour to eight against - although one MSP voting against the motion later said he had done so by accident. Three MSPs abstained.

Campaigners from both the Vote Leave and Scotland Stronger in Europe campaigns staged events outside the parliament to mark the debate.

Fiona Hyslop, the Cabinet Secretary for External Affairs, argued that 300,000 Scottish jobs were dependent upon exports to the EU.

She called on the Leave campaign to "cease their smears, speculation and downright ludicrous arguments", and told the Remain campaign that "their incredible Project Fear tactics" could alienate voters.

Ms Hyslop said: "The EU is not perfect but it is a remarkable achievement that in over six decades it has secured cooperation over conflict, pursued a shared sense of collaboration, exchange and purposeful endeavour to work in concert not just to advance the interests of its own members but the world on a global scale.

"It is on that positive basis the Scottish government is of the view Scotland as part of the UK should remain in the EU."

Image caption Fiona Hyslop hit out at negative campaigning from the Leave and Remain campaigns

Labour leader Kezia Dugdale also made a passionate argument in favour of a Remain vote, saying there is "something beautiful about being part of this European family".

She also warned against the danger of "populist" arguments, but said "we are more secure in bigger alliances than standing alone."

A number of new MSPs used their first Holyrood speeches to advocate staying in the EU, including new Green member Ross Greer and Tory Adam Tomkins.

Analysis by Brian Taylor, BBC Scotland political editor

By definition, a referendum presents us all with a choice. That was true with the independence plebiscite in 2014. It is true now with the vote over whether the UK should remain within the European Union or not.

As in 2014, it is a simple choice - Remain or Leave - but a complex decision, with a range of competing factors.

That complexity, those layers, were on display at Holyrood today in what was a rather intriguing debate. More interesting than the advance arithmetic would have suggested, with the vote weighed heavily towards Remain.

Firstly, let me praise those MSPs who were speaking for the first time. Each delivered cogent, substantive contributions. Seriously, they were good. It would be invidious to single any one out. So I won't. Ok, maybe later.

Read more from Brian

Conservative MSP Margaret Mitchell was the first to make the case for those arguing that the UK should leave the EU.

She said Scotland has "four tiers of government", arguing that people know little about their EU representatives - and "couldn't care less" about it.

Describing it as "an out-dated and failing institution", she said the EU would still look to trade with the UK in the event of a Brexit. She also said the Common Agricultural Policy "short changes" Scottish farmers.

Ms Mitchell argued that EU membership and the free movement of people could also put "unsustainable pressure" on public services and the benefits system.

She said nobody could predict what the future would bring regardless of the outcome of the referendum, but argued that the UK had the talent to prosper outside of the EU.

Image caption Labour's Elaine Smith and Tories Margaret Mitchell and Graham Simpson spoke out against EU membership

Ms Mitchell's fellow Tory MSP Graham Simpson and Labour's Elaine Smith all argued that Britain would do better outside the European Union.

Mr Simpson said the small number of MSPs backing Brexit meant Holyrood was "not reflective of Scotland at large", although he claimed that there could be at least one SNP member secretly planning to vote no, even if they were "not allowed to say so".

Meanwhile, Ms Smith put forward a left-wing, socialist case for leaving the EU, arguing that the union was an "undemocratic superstate" with an "unelected bureaucracy at its core".

Ms Smith was joined in voting against the motion by seven Conservatives; Ms Mitchell and Mr Simpson, Ross Thomson, Alexander Stewart, Maurice Corry, Gordon Lindhurst and Oliver Mundell - although it later emerged Mr Corry had "pressed the wrong button".

This puts Mr Mundell on the opposite side of the debate to his father, the Scottish Secretary David Mundell, who backs a Remain vote.

Three MSPs abstained - Labour's Neil Findlay and Tories Jamie Greene and Alison Harris.

Image caption Campaigners from the Scotland Stronger In Europe campaign...

Image caption ...and the Vote Leave campaign held events outside the Scottish Parliament

Later on Thursday, former Scottish First Minister Alex Salmond will be among the panellists on a BBC TV debate about the EU referendum.

Mr Salmond will put the case for Remain alongside Labour's Alan Johnson, with Liam Fox of the Conservatives and UKIP's Diane James arguing on behalf of Leave.

The "How Should Vote?" debate, being hosted in Glasgow before an audience of under-30s from across the UK, will be presented by broadcaster Victoria Derbyshire.

It will be aired on BBC One between 20:00 and 21:00, and will also be available on the BBC iPlayer.

Ahead of the EU debate, BBC Scotland asked Holyrood's MSPs where they stood on membership. Just 46 out of 129 responded.

Remain

Conservatives - Ruth Davidson, Miles Briggs, Peter Chapman, Jackson Carlaw, John Lamont, Alex Johnstone, Rachael Hamilton, Elizabeth Smith, Donald Cameron, Adam Tomkins, Douglas Ross, Brian Whittle, Finlay Carson and Annie Wells.

SNP - Alisdair Allan, Linda Fabiani, Bill Kidd, John Mason, John Swinney, Stewart Stevenson, Ivan McKee and Richard Lyle.

Labour - Claire Baker, Iain Gray, Colin Smyth, Alex Rowley, Jenny Marra, Rhoda Grant, Monica Lennon, Richard Leonard, James Kelly, Claudia Beamish and Daniel Johnson

Lib Dems - Alex Cole Hamilton, Willie Rennie, Mike Rumbles and Liam McArthur

Greens - Ross Greer, John Finnie, Andy Wightman and Mark Ruskell

Leave

Conservatives - Graham Simpson, Ross Thomson and Alexander Stewart

Undecided

Conservative - Liam Kerr

Labour - Neil Findlay