Angry crabs harbour a secret weapon to deter their enemies and ward off predators when their claws are busy in combat, scientists say.

Ghost crabs, named for their sand-pale bodies and nocturnal antics, use teeth in their stomachs to “growl” at aggressors, leaving their claws free for attacking manoeuvres and general waving about.

It is the first known evidence of an animal using the sounds of its stomach to communicate, the researchers say.

“It’s definitely an advantage if a predator is up close,” said Jennifer Taylor, a biologist who studies crab communication at Scripps Institution of Oceanography in La Jolla, California. “They can pull out their claws and be ready to lunge, but still produce these sounds.”

Most crabs make noises called stridulations by rubbing their pincers together. The rasping comes from ridges or bristles that run up and down each claw.

But while ghost crabs make stridulations in the normal way, Taylor noticed further aggressive sounds coming from the crustaceans when they were taunted with rods, robotic toys called Hexbugs or the bodies of dead crabs.

“I was really intrigued by the sounds they made,” Taylor told the Guardian. “I watched them to see if they were moving something other than their claws but there was nothing going on externally.”

So the researchers looked inside. The first attempt ended in failure when one crab crushed a tiny endoscope inserted into its mouth. The next approach was more effective. Using a technique called laser doppler vibrometry, the scientists bounced a laser off the various parts of an aggravated crab. The reflections revealed that the strongest vibrations came from the animal’s gastric region.

Crabs possess unusual apparatus to help them process food. Inside their stomachs are little teeth that together form what is known as a gastric mill. In ghost crabs, the mill has a central tooth flanked by neighbours that carry their own fine comb-like teeth. A complex arrangement of muscles and nerves sends the mill into motion, allowing crabs to shred food that has already passed into their stomachs.

Taylor suspected the mill was involved in the crustacean’s defences. To find out, the team took their crabs to a medical centre where they gave them x-rays as they wrestled with rods and other items. After several attempts, the researchers captured footage of the gastric mills grinding to generate the warning sounds. The research is published in the Proceedings of the Royal Society B.

“Ghost crabs have evolved specialised structures on their claws for making sounds but they also adopt this second method as a backup,” Taylor said. “If their claws are already busy, they can make the same sounds internally.”

The crabs can grow as large as a hand and are a common sight on tropical shores, where they live in burrows dug in the sand. The animals breathe air through moistened gills that are occasionally wetted by sitting in damp sand or by running headlong into the surf.