Finance secretary Derek Mackay has warned of the risks of Brexit as the Scottish economy avoided recession, according to official figures.

The most recent statistics show GDP has returned to growth, rising by 0.3% in the period July to September after shrinking by 0.2% in the previous quarter.

Over the year, Scottish GDP has increased by 0.7% - less than the 1% growth experienced by the UK as a whole.

The latest statistics mean Scotland has escaped falling into recession - defined as six months of negative economic growth – and matched the UK's economic growth rate for the third quarter of 2019.

The official report said the spike then fall in economic growth in the previous two quarters was “linked to stockpiling and running down stockpiles around the UK's original planned Brexit deadline in March 2019 as it was moved to the subsequent October 2019 deadline".

Mackay said the pace of economic growth had slowed as a result of the "continued uncertainty around Brexit".

But Scottish secretary Alister Jack said “threats of a second independence referendum” were holding back the Scottish economy, which was “lagging behind” the rest of the UK.

The newest data, published on Wednesday, showed Scotland's agriculture, forestry and fishing sector enjoyed growth of 1.3% for July to September - the highest growth rate of any part of the economy over the period.

But it comes after the EU’s annual fisheries negotiations determined that the amount of cod Scottish fishermen are allowed to catch will be cut by 50% next year.

The production sector in Scotland grew by 0.9%, while the services sector - which makes up about three-quarters of the Scottish economy - was up by 0.2%.

Mackay said: "While it is good news the economy has grown in the last quarter, it is unsurprising the overall pace of growth has slowed as a result of the continued uncertainty around Brexit.

"Scotland has a strong economic foundation with a lower unemployment rate than the UK and we will continue to do all we can to stimulate growth, jobs and investment, and help build economic resilience.

"However, Brexit remains the biggest threat to our economy.

"Just this week the Prime Minister has put the risk of a no-deal Brexit back on the table by ruling out any extension to the transition period. This would be catastrophic for Scotland's economy.

"Scotland did not vote for Brexit and the people of Scotland have the right to determine their own future free from Brexit as an independent member of the European Union."

He also stressed the Scottish Government was "focused on delivering a stronger economy",  including plans to renew the economic action plan early in the new year.

But Jack said the Scottish Government is not doing enough with “the considerable powers at its disposal”.

The Scottish secretary said: “It is encouraging the Scottish economy has grown in the last quarter but I am concerned it continues to lag behind UK-wide figures over the last year.

“The UK Government is working hard to ensure that Scotland and every part of the UK grows and prospers.

“Getting Brexit done by agreeing the Prime Minister’s deal by January 31, putting this uncertainty behind us, will be good for Scotland’s businesses, farmers and fishermen.

“I urge the Scottish Government to use the considerable powers at its disposal and work with us to improve the Scottish economy rather than holding it back with threats of a second independence referendum.”