Scotland's population hit a new record high in 2015 thanks to immigration, mostly from England.

There are now around 5,373,000 in the country, with fully 47,000 of them recent arrivals from elsewhere in the UK.

Net migration of around 28,000 - the third highest figure on record - was not enough to reverse the trend of an ageing population.

There were more deaths than births in Scotland in 2015 - with fewer babies born than in recent years - sparking concerns more migrants were needed.

Tim Ellis, the Registrar General of Scotland, who published the latest figures, said: "The population is continuing to age and this change will bring both opportunities and challenges in the years ahead.

“As well as more people moving to Scotland than leaving, fewer babies were born during 2015 and there were more deaths than in 2014."

Scotland has been very successful at attracting migrants from England, Wales and Northern Ireland in recent years. The number of people who came to live in this country from elsewhere in the UK peaked at 61,900 in 2003-2004. Last year it was 47,200. However, another 38,000 Scots moved to the UK.

Immigration from outside Britain has grown faster. There were 37,000 migrants from other states, including, of course, native Scots returning from abroad. That compared with 18,200 Scottish residents who left the country for destinations outside the UK, including foreign-born migrants returning home.

The resulting net immigration figure of 28,000 is short of a peak of 33,000 in 2006-2007. However, it compares with mass net emigration from Scotland for much of the 20th century. As recently as 2000 Scotland was, on average, a country people left rather than joined.

Scotland's three biggest cities have been the main beneficiaries of the new influx of migrants, usually young and of tax-paying age. Net migration to Scotland among 19-year-olds was 2,288.

Edinburgh, Aberdeen and Glasgow had the highest levels of net immigration, from all sources, in both absolute and relative terms. Glasgow alone had 8,257 new residents from outside Scotland in 2015, more than anywhere else. This played a crucial role in pushing its population back over 600,000.

Scotland's biggest minority, by birth, remains English and Welsh, according to the 2011 census. There are now 477,000 people from south of the border living in Scotland. That compares with 55,000 Poles, nearly 37,0000 Northern Irish; 23,000 Indians; 23,000 Irish and 22,000 Germans (including the children of service personnel).

Scotland's population, meanwhile, continues to age but more slowly than other European countries thanks to poorer life expectancies. Some 18 per cent of Scottish residents are over 65, as of June last year. There are now 438,000 people aged over 75, up 17 per cent from 375,000 just a decade ago.

Mr Ellis added: “Although mortality rates in Scotland have generally fallen more slowly than in the rest of the UK and elsewhere in Europe, the improvements over the last 60 years are still considerable and the impact is reflected in the increase in expectation of life.

"Despite these improvements inequalities remain within Scotland.

"For example, males born around 2012 in the 10 per cent least deprived areas in Scotland could expect to live 12.5 years more than males born in the 10 per cent most deprived areas."

Labour's equality spokeswoman Monica Lennon highlighted one single statistic that underlined the gap between rich areas and poor: suicide rates are three times higher among most deprived tenth of the population.

Ms Lennon said: "These figures should be a cause of real concern for all of us, and the Samaritans have rightly called on the SNP Government to tackle link between deprivation and death by suicide.

"If we are to prevent more deaths and spare more families the pain of dealing with a death by suicide, more must be done to provide targeted support in the most deprived areas."