Nicola Sturgeon defied Theresa May and declared "there will be an independence referendum" before Brexit in her closing speech to SNP conference.

The First Minister urged the Prime Minister to reconsider her position, after she said last week she would reject a new vote, telling her she would negotiate "within reason" on the timing of such a ballot.

To massive applause and a standing ovation she told supporters: "After the terms of Brexit are clear but while there is still an opportunity to change course, the people of Scotland will have a choice. There will be a referendum."

She went on to say that the Westminster Government's reluctance to allow a new referendum because they are "terrified of the verdict of the Scottish people".

And she stressed that if - as expected - MSPs back her request for Westminster to transfer the legal power to allow Holyrood to hold another legally-binding ballot, then this would become the will of the Scottish Parliament.

"The will of our parliament must and will prevail," she said.

During her address to more than 2500 delegates in Aberdeen she also issued an open invitation to UK residents elsewhere in the UK  to move Scotland and be part of an "outward-looking, compassionate country" rather than live under a Government which wanted to "go back in time".

The SNP leader used her closing address to her party's conference to highlight the difference between the two administrations.

An independent Scotland would "unequivocally" guarantee the right of all EU citizens living in the country to stay here, the First Minister said.

She also used her speech in Aberdeen to highlight the "massive opportunities" Scotland has as a country "if we choose to grasp them".

She told the conference to imagine what will happen if Scotland chooses to stay in the single European market as an independent country.

"We will become a magnet for talent and investment from all across the UK," she said.

"So let me issue this open invitation today - Scotland isn't full up.

"If you are as appalled as we are at the path this Westminster Government is taking, come and join us.

"Come here to live, work, invest or study.

"Come to Scotland - and be part of building a modern, progressive, outward-looking, compassionate country."

She hit out at the Tories over their attitude to Scotland - saying the Prime Minister's "refusal to budge an inch" in Brexit talks between the governments had forced her to announce plans for a second independence referendum.

She accused the Conservatives of harking after the days "when Tory governments could do anything they wanted to Scotland... the days when they could impose the poll tax, destroy Scottish industry and deny all demands for constitutional change".

But the First Minister told May: "Those days are gone and they are not coming back."

She warned the Prime Minister that if she showed "the same condescension and inflexibility, the same tin ear" to other European nations as she had done to Scotland then "the Brexit process will hit the rocks".

The SNP leader blasted the UK Government over its failure to guarantee the rights of EU citizens already living in the UK.

"You cannot lecture others about politics not being a game while you are using the lives of human beings as pawns," she told May.

There were major policy announcements, with Sturgeon promising £50 million to make sure all staff working for nurseries signed up to the Scottish Government’s 600 hours of free childcare were paid the Living Wage.

In public sector nurseries, staff already receive the living wage, but there are around 1,000 private nurseries  also involved in the free childcare scheme. The First Minister said around 8,000 staff would be eligible for the pay rise.

There was also a promise of an increase in the number of dedicated mental health workers in the NHS, so that A&E departments, GP practices, police custody suites and prisons all have access to specialist help.

The First Minister said: "In total, we will increase the budget by £35 million over the next five years to support the employment of 800 additional mental health workers in our hospitals, GP surgeries, prisons and police stations."

Meanwhile, businesses could benefit from a new three-year £36 million support fund, to help them meet the costs of giving staff digital training

"Scotland can't afford to lose out on the digital revolution," the SNP leader said.

Opposition leaders at Holyrood hit out at Sturgeon and accused her of ignoring the day job.

Scottish Conservative deputy leader Jackson Carlaw said: "This is the week that Nicola Sturgeon gave up being First Minister and instead put her obsession with independence before the day job.

"This was a disappointing and negative speech. Nicola Sturgeon seems to be more interested in complaining about the UK Government than talking up her own."

Scottish Labour leader Kezia Dugdale said: "This was a speech from a First Minister who is out of ideas and obsessed by independence.

"Her attempt at wooing the majority of Scots who oppose her bid to leave the UK will fool nobody. The SNP still stands for division and grievance.

"If Nicola Sturgeon truly wants to listen to the people of Scotland, she will take the threat of a second independence referendum off the table."

Scottish Liberal Democrat leader Willie Rennie was also critical, saying: "Nicola Sturgeon repeatedly promised education would be "front and central" but yet it hardly merited a mention in her address.

"Mental health, another supposed priority, gets a few scraps instead of a step change investment it needs.

"In the blink of an eye her promises to our children and on mental health have been crushed by her out-of-control independence juggernaut."