Their skills built the nation, and for generations barely a town or village would have been without the essential talents of a stonemason.

Now as some of the most treasured examples of the master stonemasons of Scotland’s work comes under threat from time and climate change, efforts are underway to gauge how many might be left – and how more can be encouraged to learn their trade.

National agency, Historic Environment Scotland, has started a nationwide survey of stonemasonry in an attempt to better understand the current status of the sector.

The move comes against a background of growing concern over the crumbling state of some of the nation’s precious buildings: under attack from wear and tear, age and the climate crisis, in some cases stonework has become fragile and at risk of crumbling.

There are fears that, as the scale of work required on ageing buildings increases, there may not be enough stonemasons to tackle an overwhelming list of repairs.

The survey seeks to gather information on the number of stonemasons currently working in Scotland, where the businesses that employ them are based, and where their skills are most needed. According to HES, the data will be used to build a picture of how the stonemasonry sector looks across different parts of Scotland, “ensuring it is equipped to meet the challenges of the future”.

Read MoreWhat price heritage? Scotland's ancient buildings to be left to the elements

As well as providing insight into businesses which offer stonemasonry services and the breadth of their skills, the research will help inform built heritage sector on how to develop training and encourage a new generation of stonemasons to learn the age-old skills.

HES supports the delivery of stonemasonry skills training at its Skills Training Centres in Elgin and Stirling, in partnership with Forth Valley College. While stonemasons working on historical buildings require specialist qualifications covering heritage skills.

However, the traditional job has fallen out of favour among recent generations as young people move into alternative careers.

While Scotland’s construction industry as a whole has a workforce of more than 225,000, in South East Scotland alone there is said to be a construction skills supply shortage of more than 3,500 over the next decade.

Colin Tennant, Head of Technical Education and Training at Historic Environment Scotland (HES), said: “With our built environment in Scotland predominantly made of stone, it is crucial we ensure a continuing supply of trained stonemasons to repair, maintain and conserve this heritage.

“There are skills gaps within the stonemasonry sector and challenges around access to, and delivery of, appropriate training.

“Stonemasonry training is under pressure due to the changing nature of industry and funding pressures around how stonemasonry apprenticeships are delivered.

“HES is leading a short-life working group to investigate these issues and work with partners to develop sustainable training models for the future that will increase the quality and capacity of training.”

As well as rising need for stonemasons who can tackle repairs to buildings which are showing signs of decay, the shift towards ensuring traditional buildings are energy efficient has also led to an increasing in demand for their skills.

He added: “With a ‘Fabric First’ approach to retrofit, where traditional buildings need to be repaired and maintained prior to energy efficiency measures being undertaken, there is a need for more stonemasonry and traditional building skills in the construction sector. “Stonemasonry is also a sustainable traditional skill which supports both green jobs and a circular economy which helps maximise our existing resources, crucial for our national net-zero ambitions.”

Of around 2.6m dwellings in Scotland that make up the nation's housing stock, around 20 per cent are traditional buildings.

Read More: Staffing crisis hits top Scottish tourist attractions

While HES recently confirmed that a combination of climate change, damage caused by soaring visitor numbers and the natural ageing process at hundreds of the properties it cares for has raised difficult questions over which ones might be saved, and which might be left to rot.

It has been looking at hundreds of castles, abbeys, priories and other ancient structures that it manages with a view to deciding which might be left to enter a state of ‘managed decay’.

The ‘hands off’ approach would see buildings fenced off and the elements and time left to do their worst.

Mr Tennant added: “We want to ensure the sector can thrive into the future, which is why we’re launching this survey to gather information which will help us build a comprehensive picture of stonemasonry in Scotland. To help us do that, we would urge as many stonemasons and employers as possible will take part in the survey.”

“This survey will enable HES to work with industry and other providers to better develop, plan and deliver training going forward.”