SCOTLAND'S population was at its highest level last year as a result of increased migration.
GETTY Over 37,800 have moved to Scotland from overseas
New figures from the National Records of Scotland show an estimated 5,373,000 people were living in Scotland as of June last year, an increase of 25,400 from the previous year.
The figures show 85,000 people came to Scotland in the year to mid-2015 while 57,000 left, giving a net gain of 28,000.
The gain compares to 17,600 in the previous year and is the highest net in-migration figure since the year to mid-2011.
Of those who came to Scotland, the majority, about 47,200, were from England, Wales and Northern Ireland while around 38,800 people left Scotland for the rest of the UK.
Over the same period, around 37,800 people arrived from overseas and about 18,200 left to go abroad.
Migrants tended to be younger than the general population, with a peak age for inward migration of 19 and peak ages for migration out of 23 and 24, reflecting students starting and completing higher education in Scotland.
Statisticians estimate that, based on past trends, the population of Scotland will rise by 7% to 5.7 million by 2039, compared with 17% for England, 10% for Northern Ireland and 6% for Wales.
Tim Ellis, the Registrar General of Scotland, said: "Most of that increase for Scotland is projected to come from net in-migration rather than from natural change."
He said the projections did not take into account recent political developments, such as the vote to leave the EU, but added: "It's noticeable that even in a low-migration scenario the population is expected to be very slightly bigger in 2039 than it is now."
Mr Ellis said there was likely to be a "significant structural shift" in Scotland's population if current trends continue.
The population is projected to grow older as life expectancy improves, with the number of people aged 75 and over increasing by 85%, from 0.43 million in 2014 to 0.8 million in 2039.
The figures show that in 2015 there were 55,098 births registered in Scotland, 1,627 (2.9%) fewer than in 2014, resuming a trend of decline.
The average age of mothers has increased from 27.4 in 1991 to 30.2 in 2015, with the percentage of babies born to unmarried couples 51.2% compared to 33.7% in 1995.
Meanwhile, there were 57,579 deaths registered during the year, an increase of 3,340 (6.2%) on 2014.
The main causes of deaths in Scotland were cancer (16,093), respiratory diseases (7,669) deaths and ischaemic (coronary) heart disease (7,142).
Mr Ellis added: "The population in 1855 was 2,978,065. This year's figures show our population is still increasing, mostly due to migration, and in 2015 was at its highest ever at 5,373,000 people.
"The population is continuing to age and this change will bring both opportunities and challenges in the years ahead."