Image copyright PA Media Image caption Ms Sturgeon wants to hold an independence referendum within the next two years

Scotland's first minister has said an independence referendum is more important than ever as she urged Boris Johnson to "change course" on Brexit.

In a letter to the new prime minister, Nicola Sturgeon congratulated Mr Johnson on his appointment.

But she warned that leaving the EU on 31 October without an exit deal being agreed would cause "lasting harm".

And she said it was essential that Scotland was able to choose an "alternative option".

In his first speech as prime minister on Wednesday afternoon, Mr Johnson said he was confident a Brexit deal could be agreed before the UK's departure date of 31 October. However, he insisted the country would be leaving on that date, "no ifs, not buts".

Mr Johnson insisted in the Commons on Thursday that a "fantastic, sensible and progressive Brexit" would kill off calls for independence.

But the SNP's Westminster leader, Ian Blackford, predicted Mr Johnson would be the "last prime minister of the United Kingdom".

Ms Sturgeon used her letter to highlight previous Scottish government research which suggested a no-deal Brexit could cost 100,000 jobs in Scotland.

The research also claimed that even a free trade agreement could see a fall in Scottish national income of about £1,600 per person compared with continuing EU membership.

Image copyright Getty Images Image caption Mr Johnson hosted the first meeting of his new ministerial team on Thursday morning

Ms Sturgeon said: "I urge you to study this analysis closely so that you understand the implications for Scotland of the policy you are pursuing on Brexit and why it is therefore imperative that you change course immediately to avoid causing lasting harm to the people of Scotland.

"However, given your public comments about leaving the EU on 31 October with or without a deal, 'come what may' and 'do or die', it is now - more than ever - essential that in Scotland we have an alternative option.

"In line with the democratic mandate given to us in 2016, the Scottish government will continue to make preparations to give people in Scotland the choice of becoming an independent country."

Ms Sturgeon also said it was a "basic democratic principle" that the people of Scotland should be able to "determine their own future".

Image copyright Getty Images Image caption Ruth Davidson is said to be "livid" over the sacking of David Mundell as Scottish secretary

The first minister announced in April of this year that she wanted to hold indyref2 by 2021, although she conceded that she would need the consent of the UK government before that could happen.

Mr Johnson pledged during the Conservative leadership contest that he would be "minister for the Union" as well as prime minister.

He used his speech outside 10 Downing Street on Wednesday to describe the nations of the UK as the "awesome foursome that are incarnated in that red, white, and blue flag".

And he said that the United Kingdom made all four nations "so much more than the sum of their parts, and whose brand and political personality is admired and even loved around the world".

Image copyright PA Media Image caption Alisrter Jack has been appointed as the new Scottish secretary

Mr Johnson sacked Scottish Secretary David Mundell - who has openly criticised him in the past - as he carried out a major overhaul of the cabinet, with Dumfries and Galloway MP Alister Jack taking over the role.

Mr Mundell told the BBC's Good Morning Scotland programme that he would have been willing to remain in Mr Johnson's cabinet so he could work with the prime minister to "secure Scotland's place in the Union and to deliver Brexit."

BBC Scotland understands there is anger among some Scottish Conservatives over his sacking - with a source saying that party leader Ruth Davidson is "absolutely livid".

Ms Davidson, a close political ally of Mr Mundell, said earlier this week that she wanted him to remain in the job, and that the new prime minister "would do well to take David's advice on Scotland".

She added: "If the prime minister chose to keep on David Mundell, I would be very happy with that."

The source also claimed that the possibility of the Scottish Conservatives breaking away from the UK party was "high and growing", and was likely to be "the first and possibly the only item on the agenda" during an "away day" for Tory MSPs at the end of August.

Mr Jack used his first public statement to defend the Union, and promised to stand up for the majority of Scots who voted to remain part of the UK in the 2014 referendum "against those who would try to impose unwanted and divisive constitutional change".

He said: "We need to continue to defend the Union against those who would seek to tear it apart. In 2014, the people of Scotland voted to remain part of a strong United Kingdom.

"We will stand up for their decision against those who would try to impose unwanted and divisive constitutional change."

Mr Jack attended the first meeting of Mr Johnson's new Cabinet on Thursday morning.

The SNP manifesto ahead of its victory in the last Holyrood election said a referendum should be held if there was a "significant and material change in the circumstances that prevailed in 2014, such as Scotland being taken out of the EU against our will".

Ms Sturgeon said immediately after the EU referendum that the 2015 manifesto pledge gave her a mandate to hold another referendum in the autumn of 2018 or spring of 2019.

She put her plans on hold after the SNP lost 21 seats in the 2017 general election, with the first minister admitting that the prospect of an independence referendum was a factor in the result - which saw her party's share of the vote drop from 50% to 37%.

But the SNP and Scottish Greens continue to form a pro-independence majority in the Scottish Parliament.