Angus Robertson, the Westminster SNP leader, has told STV the UK is facing a "constitutional crisis", with Leave closing in on victory in the EU referendum.
"If it is the case that Scotland has voted to remain in the European Union and we are watching the potential of Scotland being taken out of the European Union, the diametrically opposed position to what we were promised, this will bring about a constitutional crisis in the UK," he said.
The party leader said her MPs may be in a position to act as deal makers - and they would refuse to allow an exit from the EU.
Scotland's First Minister said her government will seek 'immediate discussions' with Brussels to "protect Scotland's place in the EU".
An emergency meeting will be held today to discuss the Scottish government's next steps following the UK's decision to leave the EU.