Members of the Scottish National Party have voted to ditch their 30-year policy of opposition to defence alliance Nato.

Members debated the issue at their party conference in Perth.

Angus Robertson MP put forward a resolution saying an independent Scotland should become a member of the pro-nuclear weapons organisation.

That was opposed by several MSPs and rank and file members, but the new policy was voted through 426 to 332.

Mr Robertson told the conference that the fresh approach was developed following discussions with other countries.

How the voting went The amendment to reject the motion (Amendment C) was defeated by 394 votes to 365 votes.

The amendment on a "remit back", (in other words to put off a decision on the issue) was defeated by 425 votes to 360 votes.

The motion to support Angus Robertson's Nato policy change was passed by 426 votes to 332 votes.

He added that a change of view was dependent on Trident nuclear weapons - which are currently based at Faslane Naval base on the Clyde - being removed from Scotland.

It would also be dependent on Scotland's refusal to host nuclear weapons in the future, Mr Robertson.

He told the gathering: "This defence policy sends a very important message to people in Scotland and to friends, neighbours and allies.

"We are preparing for a referendum and for a sovereign, independent Scotland, with a defence and security policy that is best for Scotland."

Speaking against the policy change, SNP Highlands and Islands MSP John Finnie said if the party voted to back Nato in an independent Scotland then it would not get rid of Trident nuclear weapons from Scottish shores.

Mr Salmond sat on the platform throughout, applauding those who backed Nato membership, but he deliberately chose not to intervene in the debate itself

He said: "Scotland has a very distinctive education, health and justice system and I think the SNP government has got different priorities from the UK government."

"This self-styled defence policy update is not in that distinct social justice vein - it's more of the same UK."

Looking over to SNP leader, Alex Salmond, and his deputy, Nicola sturgeon, Mr Finnie said: "You vote to join Nato, you will not get rid of trident.

"You vote to join Nato and there will be pressure and there will be phone calls to this man and his deputy not to be involved in CND, not to support the Palestinians and similar causes around the globe."

SNP leader Alex Salmond has said he believed it was "perfectly feasible" to join Nato while maintaining an anti-nuclear stance.

Amendment (C) to resolution "As Nato continues to be a nuclear weapons-based alliance, conference resolves that the SNP position will continue to be that Scotland should not remain a member of Nato, but instead co-operate as part of the Partnership for Peace programme and be a full member of the Common Security and Defence Policy (CSDP) of the European Union and the Organisation for security and co-operation in Europe." Backed by more than 20 members including - Jamie Hepburn MSP; Jean Urquhart MSP; John Finnie MSP; Dave Thompson MSP; Gordon Macdonald MSP; Marco Biagi MSP; Bob Doris MSP and Sandra White MSP

The resolution before conference said: "On independence, Scotland will inherit its treaty obligations with Nato. An SNP government will maintain Nato membership subject to an agreement that Scotland will not host nuclear weapons and Nato continues to respect the right of members to only take part in UN sanctioned operations."

But that proposal found opposition from eight SNP MSPs - including Mr Finnie, Jamie Hepburn, Marco Biagi and Sandra White - and a number of local SNP councillors.

In an amendment, they aksed conference to keep the status quo because "Nato continues to be a nuclear-based alliance".

Speaking at a conference seminar in Perth on Thursday evening, Mr Robertson said he was asked on a fact-finding trip with the first minister to neighbouring countries if the Scottish government understood the importance of Nato air cover to the North Sea.

He said: "I asked what the impact would be of Scotland not being in Nato.

Image copyright PA Image caption Alex Salmond holds aloft his voting card

"The answer came that the simplest way to describe it is pulling the plug on the radar. Everything that is around Scotland turns into a black hole where we have no idea what's going on, and that worries our neighbours intensely."

Mr Salmond told BBC Scotland ahead of his party's conference that changing policy "was the right thing".

He explained: "All parties should change their policies to equip them for the modern world and the long-term consistency in SNP policy has been opposition to nuclear weapons.

"The SNP, in my lifetime, has been pro-Nato, we've been anti-Nato, we've been in favour, as we are now, of Partnership for Peace, which is a Nato organisation, so that's been an emphasis on the policy. But the underlying consistency is our opposition to nuclear weapons and the best way to remove Trident from Scotland.

"An independent Scotland would not have possession of or allow nuclear weapons in Scottish territory.

"Twenty-six out of the 29 countries in Nato are non-nuclear countries, it is perfectly feasible for Scotland to be one of these but still engage in collective defence for friends and allies."

Image copyright PA Image caption Resolution proposers Angus Robertson and Angus MacNeil show relief after the vote

The question about Nato was part of a wider debate about the SNP's proposed foreign, security and defence policy in an independent Scotland.

Mr Salmond signed a deal with Prime Minister David Cameron on Monday which lays down the ground rules for holding a referendum on Scottish independence.

Mr Robertson detailed to the Perth conference that a go-alone Scotland would commit to an annual defence and security budget of £2.5bn - which he said was nearly £1bn less than Scots taxpayers currently contribute to UK defence spending.

It is projected that Scottish armed forces would comprise 15,000 regular and 5,000 reserve personnel operating under a joint forces headquarters based at Faslane.