Scientists have been able to observe birds falling asleep mid-flight for the first time - an ability that's long been suspected but never been proven.

But even though researchers had thought this might be the case, the new research shows that the way birds nap in the air is much stranger than we ever expected.

The discovery can finally help explain how birds can fly for days and weeks at a time without ever coming in to land - something that's divided the biology community for decades.

That's because, without knowing what goes on in the sky, scientists weren't sure whether birds were staying awake through their journeys, or just resting one hemisphere of their brain at a time - something that ducks have already been observed doing on land to avoid predators.

The new research found both the expected and the unexpected. By measuring the brain activity of frigatebirds - seabirds known to fly for weeks at a time over the ocean in search of fish - researchers showed once and for all that birds can shut down one hemisphere at a time during flight, as expected.

But they can also rest both hemispheres at once - something scientists didn't expect them to be able to do while remaining airborne.

To figure this out, a team from the Max Planck Institute for Ornithology in Germany developed a small device that was able to measure electroencephalographic (EEG) changes in birds' brain activity.

This device, which they called the "flight data recorder" was able to detect both slow wave sleep and rapid eye movement (REM) sleep, and they attached it to 15 adult female frigatebirds.

The team recorded their brain activity over 10 days and more than 3,000 kilometres of flight, while a GPS device also tracked the birds' position and altitude.

After the birds had landed and had some time to recover, the researchers collected the flight data recorders to analyse the recordings - and were surprised by what they found.

During the day, the birds would stay awake and actively search for fish. But as the sun set, the birds switched into slow wave sleep for several minutes at a time while they continued to fly over the water.

More often than not, the birds just rested one hemisphere at a time, which is something the researchers had expected. In addition to ducks, we know dolphins are able to continue swimming while they sleep by leaving one hemisphere on the lookout for danger. Humans also do this when we fall asleep in a new location.

When frigatebirds showed this behaviour, the recording devices revealed that they were usually circling on rising air currents, and they only kept the hemisphere connected to the eye that was facing the direction of the turn awake. This suggests that they were looking where they were going while napping.

"The frigatebirds may be keeping an eye out for other birds to prevent collisions much like ducks keep an eye out for predators," said lead researcher Niels Rattenborg.

But the EEG recordings also showed both hemispheres going into slow wave sleep at the same time, which unexpectedly suggested that birds were able to maintain aerodynamic control even when their entire brain is asleep.

On rare occasions, the birds even went into brief periods of REM sleep while they remained airborne - something that sounds pretty weird, seeing as the state is associated with total muscle relaxation in most mammals.

But in birds, REM sleep only lasted several seconds during flight, and the only noticeable muscle relaxation was a slight droop of the head.

The results back on land showed that the birds were even able to stand on one leg during this state.

This was all fascinating, but perhaps the biggest surprise was the fact that, despite this unique ability, frigatebirds slept less than an hour a day, or 42 minutes on average, to be precise - less than 10 percent of the time they normally spend sleeping on land.

This suggests there's an evolutionary trade-off to taking a nap on the wing - so, perhaps birds are more likely to have collisions or miss out on food while sleeping - but more research needs to be done to figure out what's really going on.

"Why they sleep so little in flight, even at night when they rarely forage, remains unclear," said Rattenborg.

More investigation is also needed into how the birds function on such little sleep - something that would be disastrous for humans.

"Why we, and many other animals, suffer dramatically from sleep loss whereas some birds are able to perform adaptively on far less sleep remains a mystery," Rattenborg added.

So while the new study answers one question - how birds stay airborne for weeks at a time without taking a break - it's now opened up several more... which is what's so great about science. Our work is never done.

We can't wait to see what they find next.

The research has been published in Nature Communications.