Scotland’s population reached its highest-ever level at more than 5.3 million last year.
By mid-2014 the number of people had risen by 19,900 on the previous year as more people were born than died, and more people moved to Scotland than left.
Between mid-2013 and mid-2014, about 49,240 people came to Scotland from the rest of the UK while 39,660 left Scotland to go in the opposite direction, giving a net migration gain of approximately 9,600, according to figures from the National Records of Scotland (NRS).
During that period, 33,200 people came to Scotland from overseas and 25,200 left Scotland to go overseas, boosting the country’s population by 8,000.
Other changes, such as in armed forces and prisoners, resulted in a loss of around 1,200 people.
In addition, about 3,500 more people were born than died between mid 2013 and mid 2014, taking the country’s estimated population to 5,347,600.
There were approximately 2,596,384 males and 2,751,216 females.
The NRS statistics published today also showed that migrants to Scotland tended to be younger than the general population, with more than two-thirds of migrants from overseas and nearly half of migrants from the rest of the UK aged between 16 and 34.
In the resident population as a whole, only a quarter were in this age group.
Meanwhile, only seven per cent of people coming to Scotland from the rest of the UK and one per cent of people arriving from overseas were aged 65 and over.
The average age of Scotland’s population was lower in the big city areas than in more rural council areas, the statistics showed.
It was 35 in Glasgow City and 36 in Aberdeen City and the City of Edinburgh while in more rural council areas such as Argyll & Bute, Dumfries & Galloway, Eilean Siar, the Scottish Borders and South Ayrshire it was 47.
According to the figures, the population increased in 23 council areas and decreased in nine council areas.
Midlothian had the largest percentage population increase at 1.8% while Inverclyde had the largest percentage population decrease at -0.6%.