Scientists refer to the worms as "ecosystem engineers" because of their ability to influence soil structure
Scientists are to begin a survey to determine how many earthworms there are in Scotland.
Researchers in Dundee and Aberdeen are hoping the results of the study will help them understand how climate change is affecting earthworm numbers.
They plan to visit 100 farms across the country to count the worms and compare the results with a similar survey carried out 18 years ago.
The study will also consider what other factors might influence worm numbers.
Scientists refer to the worms as "ecosystem engineers" because of their ability to influence soil structure.
Charles Darwin observed that the creatures were also able to provide soil with "natural compost" by recycling plant material.
The survey, which is unique in the UK, is being conducted by the Macaulay Land Research Institute in Aberdeen and the Scottish Crop Research Institute (SCRI) in Dundee.
Dr Roy Neilson of the SCRI said the worms could play a vital role in preventing some natural disasters.
He said: "There are three different groups of earthworms - those that stay near the top of the soil, those that burrow horizontally and those that burrow vertically.
"The paths of the horizontal and vertical earthworms cross, creating important natural drainage channels in the soil.
"If there is a reduction in the earthworm population there would be less natural drainage, and that combined with increased rainfall caused by climate change could result in more flooding."
The previous earthworm survey, conducted in 1991, sampled two separate fields at each of the 100 farms chosen, in order to provide an accurate statistical representation of Scotland.
The current survey will repeat these samples and compare the results.