Researchers in the US have revealed a secret of the success of invasive fire ants - they can excavate any type of soil.
Three-dimensional scanning revealed that the insects were able to build their complex nests regardless of the size of grains they needed to move.
The ants also changed their excavation techniques depending on the type of soil in which they were digging.
The findings are published in the Journal of Experimental Biology.
Lead researcher Prof Dan Goldman, from the Georgia Institute of Technology, told BBC News that while we "shove this kind of material around using bulldozers", fire ants create complex underground structures using discreet little appendages.
"They're really grasping and holding," he said.
"They're more sophisticated manipulators of [sand and soil] than anything humans have ever engineered."
The species the team studied, Solenopsis invicta - also known as the red imported fire ant - is a particularly successful engineer.
Native to South America, colonies of thousands of these industrious insects have established themselves throughout the US, Australia and China.
"They invaded [the US] 80 years ago and they have dug nests from Georgia to LA - they can dig in anything," said Prof Goldman.
He and his colleagues tested the ants' excavation abilities by letting groups of 100 ants dig in cylinders containing three different types of soil - small, medium-sized or large grained.
They also tested the ants in soils containing different levels of moisture.
They devised an experiment that enabled them to x-ray the ants' nests as they evolved over 40 hours.
On average the ants built tunnels faster in coarser soils, and built more complex branched structures in the more moist coarse soils.
Water particles create forces that stick soil grains together, making the structures more robust.
"But it was basically the case that, once you get above about 5% moisture content, they will dig tunnels," said Prof Goldman.
Digging in glass
In the second part of its experiment, the team wanted to capture each individual ant in action.
Researcher Daria Monaenkova managed to film the ants as they dug in transparent cylinders filled with glass beads of different sizes that the ants treated like soil.
This very visual experiment showed that the ants had two distinct excavation methods.
In the coarse beads, they would grasp a single particle and shuffle backward up the tunnel, dragging it with them.
But in the smaller beads - imitating finer soil - the ants grasped and compressed multiple grains into a pellet, while bracing themselves against the sides of the tunnel with their legs.
They then gathered their pellet, turned and marched upward.
Prof Goldman said he was most surprised by the ants' inventiveness, moulding these pellets - that were always the same size - like snowballs, using their forelimbs, jaws and even using their antennae.
"It is just mind blowing how they can dig so well," he said.
He added that the studies could help in the design of search and rescue robots able to work in large teams, and able to manipulate their environment in unstable conditions, such as collapsed buildings.
"When we want to send in teams of robots in the natural environment, you have the problem of getting in each other's way, and jamming things up," he told BBC News.
"So [these insects demonstrate] how large teams can work in cramped conditions and even create structures in loose materials."
Dr Roderich Gross from the University of Sheffield has designed robots that are programmed to work on ant-like principles - functioning as a collective swarm, or 'superorganism' in order to complete a task.
He told BBC News that ants' ability to manipulate substrates of different granularity was "likely to make its way into next-generation robotic systems".
"Swarms of robots with advanced manipulation skills could be applied in construction, disaster response and mining," he said.