IDOMENI, Greece — Taha al-Ahmad’s family is sleeping in mud. His youngest daughter, age 1, lies beneath wet blankets, coughing inside their soggy tent. It has rained for days. Portable toilets are overflowing. Men burn firewood to stay warm. A drone circles overhead. Television trucks beam images of misery to the world.

It is primeval, and surreal, this squalid, improvised border camp of 12,000 refugees, a padlocked waiting room for entering the rest of Europe. Mr. Ahmad, barely two weeks out of Syria, does not understand why his family cannot cross the Macedonian border — roughly a football field away — and continue toward Germany. Hundreds of thousands of migrants passed through last year, but now Macedonia is closed. Europe’s door is slamming shut.

“I am in a very high degree of miserable,” Mr. Ahmad told me, speaking in a singsong English he learned in Syria, as our shoes sank into the muck.

“I ask my friends in Germany and Turkey: ‘What is happening? Tell us,’” he said. “We don’t know what is happening outside.”

To Mr. Ahmad, “outside” is the world of politics and policy beyond the wretchedness of the Idomeni camp. In Idomeni, refugees exist in a decrepit suspended animation. Disease spreads. Grandmothers sleep beside train tracks. Outside, specifically in Brussels, the leaders of the European Union, under public pressure to stop the migrant flow, will begin discussing the fate of refugees on Thursday, and a disputed plan to deport them to Turkey.

“Impossible,” Mr. Ahmad said, startled at the suggestion that his family — having fled war in Syria, traversed Turkey and paid a smuggler to reach Greece by raft — could be forced to return. “I can’t accept this idea.”

For now, Idomeni is a locked gate, where refugees wait anxiously, hoping the border will reopen. Greece, itself nearly bankrupt, is at risk of becoming a refugee prison, with more than 44,000 people already trapped in the country, a number ticking upward each day, as aid groups warn of a potential humanitarian crisis by summer.

I walked into the Idomeni camp last Thursday to begin a journey across Greece and witness firsthand the new dynamic of Europe’s migration crisis — refugees, desperate and exhausted, are now frozen in place in a troubled country without the means to absorb them and no ability to pass them on.

Greece is now ground zero for the two greatest challenges to afflict Europe in recent years: the debt crisis and Germany’s insistence on austerity as the only cure, and the backlash against the wave of human migration from war-torn and impoverished countries.

Traveling along the migrant trail in reverse, from Idomeni in the north down to Athens and across the Aegean to the islands where refugees arrive from Turkey, amounted to a tour of dashed hopes: for refugees who are barred from going forward and do not want to go back, and for the Greek people, who see little chance of escaping the economic and social trauma of the past decade.

Idomeni was already an emblem of the human cost of European Union policy dysfunction, and Greece is now hurriedly opening official refugee centers in military camps, a bankrupt hotel, the decaying Olympic Park in Athens — even in a castle.

Greek officials warn that refugees might be stranded in the country for two years. So many are stranded at the port of Piraeus, near Athens, that the passenger terminals — usually where vacationers wait for ferries to the islands — are crammed with sleeping Syrians and others. On Saturday morning, a group of bewildered Korean tourists wandered into a terminal transformed into a Little Syria.

The question is when frustration will boil over, whether by Greeks already embittered by the economic crisis or by refugees angry at being penned in. On Monday morning, hundreds of disillusioned refugees marched out of Idomeni — some of them shouting, “Going to Germany!” — and forded a river to enter Macedonia.

Several hundred people made it to Moin, a Macedonian village. There, the police stopped them, and returned them to Idomeni.

“You can’t imagine this happening in Europe,” Babar Baloch, a spokesman for the Office of the United Nations High Commissioner for Refugees, said days earlier while standing in Idomeni. “This is a humanitarian emergency.”