Portugal's white storks were once a migratory bird, known to leave the area each winter to travel to Africa's warmer climes.

But recently they have been staying put.

This sounds worrying. Any drastic alteration of an animal's natural behaviour often has negative impacts. Surprisingly, though, stork numbers have actually been on the rise.

There are now thought to be more than 14,000 birds in Portugal in winter – a tenfold increase over the last 20 years.

Their increase has also coincided with a growing number of landfill sites in the area, providing the birds with a ready supply of fatty, nutritious rubbish to dine on, including junk food.

The landfill was indeed giving the birds access to food all year round

Researchers sought to understand exactly why their natural behaviour had changed in this way. Was it the junk food that stopped them migrating, or is Europe's warming climate to blame?

To understand, a team monitored 48 white storks by fitting them with small GPS monitors. This tracked their locations five times a day, monitoring how often they travelled to landfill sites as well as how fast they flew.

The conclusions were startling. The landfill was indeed giving the birds access to food all year round. This in turn influenced where they nested, bred and – crucially – their home ranges.

The birds also established more colonies next to landfill sites – the team estimated that 80% of Iberia's white storks were spending most of their time by the rubbish, results which they outline in the journal Movement Ecology.

What they are trying to get at are leftovers that we throw away

There, they eat almost anything, not all good, or in fact, edible. "Every time a truck with rubbish is unloaded on one of these landfill sites, they grab what they can," says Aldina Franco of the University of East Anglia in the UK, a co-author of the study.

The storks have even been known to eat plastic, including old computer parts. "Really what they are trying to get at are leftovers that we throw away… like hamburgers, leftover meat and fish," Franco told the BBC's Science in Action programme.

This now-plentiful supply of food will soon dwindle, though, as new regulations from the European Union Landfill Directive stipulate that waste food will soon need to be recycled.

These large colonies that are located close to the landfill sites will probably face food shortages

Open-air landfills will also be replaced by covered waste processing facilities, which birds will not be able to access.

The white storks therefore face an uncertain future. Will they migrate to Africa as they had done for hundreds of years before, or will they stay put?

"What will happen if the landfill sites close is that this resource will no longer be available and these large colonies that are located close to the landfill sites will probably face food shortages," says Franco.

They will either revert to their usual foraging strategies, feasting on small insects, or some may starve.

These birds have adapted their behaviour to stop migrating in just 30 years. The hope is that they will be able to reverse this trend just as rapidly, and begin to behave as they had done before fast-food reigned them in.

"Basically we don't know," says Franco. "We don't know whether individuals can change their migratory strategy from one year to the next.

"I am very curious to find out what the Portuguese storks will do once the landfill sites all close. We are going to continue to monitor these storks and see how they will respond to the changes."