Tucked in a tough corner of Europe, Athens has been battling foreign invasions at least as long as records can tell the tale. So as this deeply divided nation prepares for a Sunday vote about whether to swallow more painful austerity from Europe, the consequences of the outcome run far beyond whether Greece will receive a new financial lifeline.

In a Europe that is coming unmoored from a post-Cold War order that appeared stable just a few years ago, the outcome of Greece’s decision is certain to influence how European Union leaders handle the vast security challenges that stretch before them. An unprecedented migrant crisis, a war in Ukraine and a growing threat of Islamist militancy have shaken the 28-nation alliance, as nationalism and economic populism surge in many capitals.

As Greeks go to polling places Sunday for a historic referendum, the country’s instability is bound to persist no matter the outcome. With food staples dwindling in supermarkets, gas stations running low on fuel and nearly all imports grinding to a temporary halt, Greece will need help from far beyond its borders as it wakes up Monday morning to life after the decision, leaders here said.

We are surrounded by a triangle of crisis and destabilization,” Greek Foreign Minister Nikos Kotzias said in an interview, noting the conflict in Ukraine, the bloody gains by the Islamic State in Syria and Iraq, and the civil war in Libya. “Everybody has to ask himself what will happen if this center of stabilization, Greece, will be destabilized.”

Both sides have painted the vote as a decision that stretches beyond the question on the ballot, which asks Greeks whether they want to take Europe’s tough austerity terms.

Those Greeks who want to accept the offer are desperate to secure their place in Europe, mindful that Athens is closer to Damascus than to the E.U. capital of Brussels. Many who want to reject the bailout, including this nation’s leadership, vow that they want to transform E.U. structures altogether, making them more democratic and responsive to the demands of voters. A small but growing minority complains that the E.U. has brought them little but woe and that Greece ought to make a clean break.

The security risks of the turmoil will persist no matter the outcome of the referendum, allowing both sides to claim that the other choice would endanger the nation. Hundreds of refugees from Syria are landing on Greek shores every day. Russia has its eye on Athens, trying to break European unity to put an end to economic sanctions imposed over its actions in Ukraine. And Greeks of all stripes have an ever-present fear of Turkey, their neighbor and bitter rival, taking advantage of them during times of instability.

Leaders of the ruling leftist Syriza party argue that Greece’s crucial role on the frontier of a refugee crisis means that Europe could not possibly oust it from the euro club, potentially unleashing chaos that would spread far beyond Greece’s borders.

“The whole region smells like gunpowder,” said Alexandros Bistis, who leads the party’s political planning committee and is a top adviser to Prime Minister Alexis Tsipras.

For proponents of a yes vote, those challenges mean that it is far too perilous for Greece to gamble with its European orientation.

“This is the inability of a Western country in a very difficult neighborhood to contribute to collective security efforts,” said ­Thanos Dokos, the director general of the Hellenic Foundation for European and Foreign Policy, who said that a host of Greece’s security capabilities have eroded during five years of economic crisis. “We are the weak link.”

Even in the past week, there have been hints of what could be in store for Greece if its banks remain closed and the government stays insolvent without new lifelines. One struggling hospital in central Athens ran low on food. Deliveries of expensive imported drugs have slowed because money can no longer be transferred outside of the country. Butchers in the central market — who mostly sell imported meat — warned that they weren’t able to make their purchases.

The most immediate concern for Greece — and by extension, Europe — is its accelerating refugee crisis. About 68,000 migrants crossed to Greece by sea in the first six months of 2015, far more than in all of 2014, according to figures released Wednesday by the U.N. refugee agency. Most were fleeing the war in Syria.

But there is little awaiting the migrants once they reach Greece’s shores, a problem that has only accelerated as the economic difficulties have mounted in recent months. With Greek unemployment rates at 25 percent, there are few if any jobs for migrants. And there are virtually no state services available. The United Nations has called the government’s reception facilities “deeply inadequate.”

Since coming to office in January, the ruling Syriza party has effectively withdrawn support from the facilities, believing that migrants should not be detained on arrival and should instead be free to journey onward.

But huge numbers of migrants end up marooned in Greece because of the cost and arduous travel involved in moving on to other parts of the European Union. In Athens and on holiday-destination islands lapped by aqua green waves, informal camps have sprung up, with migrants sleeping in parks and on sidewalks.

Zoe Apostolopoulou, who directs immigration policy for the centrist Potami party, said the influx is likely to intensify if Greece rejects Europe’s bailout offer and economic conditions deteriorate. The opposition politician said she fears that the cash-starved government will divert funds away from maritime patrols, making the country an even more attractive destination for the people-smugglers who organize boats to take migrants across the Mediterranean.

“If they know that everything is more or less paralyzed, they’ll take advantage,” she said. “And the humanitarian crisis will only get worse.”

Russia, smarting under the weight of Western sanctions after last year’s annexation of the Crimean Peninsula from Ukraine, has dangled the possibility of loans for loyalty. Russian President Vladimir Putin feted Tsipras in St. Petersburg last month as bailout negotiations took place in Brussels. Greece belongs to NATO and the European Union, powerful alliances that have taken an anti-Russian stand.

Analysts in Moscow and Athens say the flirtation is more show than substance. But NATO had sufficiently strong concerns about the loyalties of the new Greek government that top officials talked about how to keep sensitive discussions out of Russian hands shortly after Syriza’s January victory, a senior NATO official said at the time.

Greek Deputy Defense Minister Costas Isihos said that worries about his nation’s dealings with Russia are overblown. But he said that E.U. leaders risk breeding a generation of young people with anger toward Brussels if they keep pushing austerity with no hope for the future.

“The Greek people have a proud history as a sovereign nation,” Isihos said in an interview. “When you hit people below the belt, you get a different result than you expect.”

Read more:

Greeks take to the streets for dueling rallies that reflect a divided nation

7 questions about Greece’s huge crisis

18 key facts about Greece to update you on the crisis

Why Greece and Germany don't get along, in 15 charts