Pity the desert rattlesnake. The food this snake likes to eat — squirrels, rabbits and mice — isn't exactly plentiful in the great sandy void.

And the one edible animal that's commonly found in the California desert turns out to be a ninja rat.

Well, technically they're called kangaroo rats. But, as a new study — and downright dazzling video — suggests, those feet are fast as lightning.

For the study published this week in the journal Functional Ecology, researchers at the University of California and San Diego State University placed high-speed cameras in the desert.

Their aim? To find out exactly how kangaroo rats evaded the snake's perilous clutches.

A kangaroo rat in the desert Native to North America, kangaroo rats use their powerful back legs to hop like their namesake. (Photo: Nicholas Taffs/Shutterstock)

After all, the desert is teeming with kangaroo rats. How do they manage to thrive in a place where the ground is literally crawling with rattlesnakes?

For the answer, researchers slowed the video results to a crawl and analyzed the mechanics of each interaction between predator and potential prey.

"The resultant videos provide the first ever detailed look at the maneuvers that kangaroo rats use to defend themselves against a deadly predator," researcher Timothy Higham noted in a press release.

What they found was a violent ballet with perfect timing, razor-thin reactions and the occasional dropkick — as rat after rat evaded the rattlesnake's death lunge.

But how, the researchers wondered?

After all, rattlesnakes strike at the lightning speed of 100 milliseconds or less. If you're wondering just how quick that is, just blink. It probably took you about 150 milliseconds.

But those kangaroo rats — so named for their long, powerful hind legs — responded in about 70 milliseconds.

That 30 millisecond gap turned out to be the difference between life and death for the rats.

"Both rattlesnakes and kangaroo rats are extreme athletes, with their maximum performance occurring during these interactions," one of the researchers, Higham explained. "This makes the system excellent for teasing apart the factors that might tip the scale in this arms race."

Of course, there are variables. Not every rat is so fleet of foot. And some rattlesnakes are just faster — or hungrier — than others.

But even if they're a hair too slow to avoid the snake's strike, some kangaroo rats revealed a last-ditch weapon from their arsenal: a dropkick.

"Kangaroo rats that did not react quickly enough to avoid the strike had another trick up their sleeves," noted study co-author Rulon Clark. "They often were able to avoid being envenomated by reorienting themselves in mid-air and using their massive haunches and feet to kick the snakes away, ninja-style."

Certainly, we've seen animals go to extreme ends to avoid an untimely death. Even the common cockroach, when faced with a grim fate at the hands of the jewel wasp, is known to turn to kung fu.

But the kangaroo rat seems to steal a page from a grand martial arts epic: Crouching Rat, Hidden Rattlesnake.

In one video, a rat is seen twisting away from a pouncing snake with such uncanny timing, its back leg strikes the snake square in the head. The predator is sent hurtling through the air. The prey bounds away, living to kick another day.

In fact, the entire sequence, even in slow motion, is so seamless, researchers wondered if perhaps the rat did get bitten. To be sure, they tested kangaroo rat blood to make sure they're not physically immune to snake venom.

Nope. They just happen to live in a frame-by-frame kind of world, where they can take to the air a fraction of a second faster than a rattlesnake's strike.

"These lightning-fast and powerful maneuvers, especially when executed in nature, tell us about the effective strategies for escaping high-performing predators," Higham added. "Those that are successful at evading the strike will suggest ways in which the kangaroo rat might be evolving in response to the intricacies of the predatory movements."

WATCH: Desert rats rely on dazzling kung fu moves to escape rattlesnakes
How do desert rats avoid being gobbled up by rattlesnakes? Timing and a good old-fashioned dropkick.