To beat the heat, some animals crawl into underground burrows. Some take a dip in a stream or watering hole. Some sweat. Some pant.

For koalas, who spend most of their lives high in the trees, the options are pretty limited. There are no burrows to hide in or pools to splash in. Koalas are also found across a broad range of environments in Australia, says Natalie Briscoe, a research fellow at the University of Melbourne. Where it's humid, panting might not do them much good, and in dryer places, it can put them at risk for dehydration and death. Briscoe wondered if there was some other behavior the helps koalas cope with the heat. Maybe they stick to shadier parts of their trees, or sit differently when it's hot out.

In a paper published Tuesday, Briscoe and a team of researchers from Australia and the U.S. reveal the koala's behavioral trick for keeping cool:

They hug trees. Literally.

To see how koalas changed their behavior in the heat, Briscoe and her colleagues fitted a bunch of the marsupials with radio collars and tracked them over several months through Australia's summer and winter, noting how they spent their time, their posture, what kind of tree they were in, and where in the tree they sat.

"We mounted a portable weather station on an extendable pole so we could record the conditions the koalas were experiencing up in the trees," says Briscoe. "This was quite challenging, particularly during windy weather, but my balancing skills and upper arm strength certainly improved!"

The koalas acted differently depending on the weather. When it was hotter out, the animals spent more time in Australian acacia trees, which they didn't typically use in milder weather. They also moved to the lower parts of the trees and sat with limbs stretched out, hugging the trunks and bases of the lower branches.

At first glance, this didn't appear to do them much good. The spots the koalas sat in near the tree trunks weren't any cooler or less humid or breezier than any other place they could have chosen. "It was only when we measured tree surface temperatures and obtained thermal images that the behavior of the koalas made perfect sense," says Briscoe.

Using a thermal imaging camera, the researchers found what was drawing the koalas to the trunks. During hot weather, the surfaces of the tree trunks were much cooler than the surrounding air, and relatively cooler than their branches and canopy. In the acacia trees that the koalas clung to when it was hot out, the trunks were as much as 7 to 9 degrees C cooler than the air temperature.

By giving a tree trunk a hug and pressing as much of their body as they can against the cool surface, the koalas lose heat through conduction. This cuts the amount of heat they need to ditch through panting by half, according to a model of heat exchange that the researchers developed, saving the koalas precious water and increasing their survival during heat waves. The trunks aren't just cozy places to grab a nap; they also act like heat sinks that keep koalas (and, the researchers say, probably other tree-dwelling animals like leopards and monkeys) cool and alive.