For a hungry fruit fly, the choice was stark: cross an electrified barrier for food, or stay safe and go without. At the University of Birmingham, researchers found that the flies’ brains weigh both hunger and the smell of a possible meal before deciding whether to take that risk.

The finding helps explain a common challenge in nature. Animals need food to survive, but looking for it can expose them to danger. Rather than letting hunger simply switch off fear, the fly brain appears to check whether food is actually nearby. That lets the animal change its behavior to match what is happening around it.

In experiments, 70% of fruit flies kept without food for 24 hours crossed an electrified barrier to reach a yeast-rich food source. When no food was present, hungry flies mostly stayed away. Flies that had already eaten also avoided the barrier, whether or not food was available.

The study, published in Science Advances, was led by Professor Carolina Rezaval and her team at the University of Birmingham, with a collaborating team led by Dr. Lisa Scheunemann at Freie Universität Berlin. The researchers used genetic methods, brain imaging and circuit mapping to trace how hunger and food smells affect the flies’ response to electric shocks.

They identified a chemical messenger linked to hunger, called leucokinin, that makes a group of brain cells more responsive to food smells. Those cells, known as PV5K1 neurons, can then reduce activity in FB2B neurons, which usually help drive avoidance of danger. Brain imaging showed that, when hungry flies smelled food, the shock-avoidance neurons responded less strongly to electric shocks.

The team also tested what happened when they changed the activity of these cells. Turning on PV5K1 neurons encouraged fed flies to approach food despite shocks—but only when food smells were present. Silencing the neurons reduced food-seeking in hungry flies. Together, the tests suggest that the circuit does not erase the danger signal. Instead, it can lower that signal when a food cue offers a reason to take a risk.

The decision-making circuit is centered in a fly brain region called the fan-shaped body. Researchers have proposed that this region has functional similarities to the human basal ganglia, a set of brain structures involved in choosing between actions. The comparison does not mean the two systems are identical, but it points to a possible shared principle: brains can combine a body’s needs with clues from the surroundings to guide choices.

Rezaval said hunger alone was not enough to make the flies take risks; they crossed only when they could sense food. By tracing the effect from a hunger-related chemical, through specific neurons, to behavior, the research offers a detailed view of how a brain balances reward and danger. The next step is to learn how broadly similar decision circuits work across animals—and what their shared features can teach us about flexible choices.