The population of Scotland is the highest ever recorded, chiefly due to an increase in migration from both EU and non-EU nationals.

The Scottish population was recorded as 5,424,800 in 2017, however, population growth has slowed in recent years.

Overall, Scotland's population is projected to rise and age, according to National Records of Scotland (NRS), which published the statistics on Wednesday.

The number of EU nationals living in Scotland rose from 209,000 in 2016 to 235,000 this year, while for non-EU nationals it rose from 128,000 to 142,000.

In terms of net migration, there were 23,900 more people coming into Scotland than leaving it in 2016-17.

But this marks a fall of nearly 8000 in the figure on 2015-16, following policies enacted by UK ministers to reduce migration levels.

The Scottish Government has called for the devolution of immigration powers to better cater for the country's economic needs.

Scotland has historically lagged behind the UK in terms of population growth and has even gone through periods of decline, partly due to a high level of Scots moving abroad.

Scottish ministers believe growing the population is essential to prosperity and combating the ageing population.

Life expectancy has increased over the past three decades, the NRS figures also reveal, but has stalled in recent years with rates varying within Scotland.

On average for the country as a whole, life expectancy at birth is currently 77.9 years for men and 81.6 years for women.

There were around 5000 more deaths than births in 2017, with this figure projected to continue rising.

Amy Wilson, director of statistical and registration services at NRS, said: "This year's review shows that while the population of Scotland is at its highest ever, at 5.42 million, and has grown by 5% over the last decade, this growth rate has slowed.

"Over the latest year, Scotland's population has grown at a slower rate than on average over the past 10 years.

"This is because of reduced migration levels as well as an increase in the number of deaths and decrease in the number of births.

"However, Scotland's population is still projected to increase to 5.58 million in 2026, and to continue rising to reach 5.69 million in 2041.

"We expect this growth to be entirely reliant on migration, as the number of deaths are projected to continue to be higher than the number of births."