On a grim march through countries that do not want them, the tens of thousands of asylum seekers making their way across Europe again faced rejection Friday, after Croatia said it could not accommodate them though their path was barred to Western Europe.

The men, women and children fleeing war and poverty were ­being forced to improvise after their once-straightforward route to the havens of Germany and Sweden was blocked by Hungary’s barbed wire and truncheons this week. For days, the refugees have been forced to devise new routes across the Balkans, using word of mouth, the kindness of strangers and instinct as borders opened then rapidly closed.

The latest obstacle was Croatia, which staggered under the weight of the influx after initially opening its arms to the refugees. By late Friday, the nation had taken in more than 17,000 asylum seekers. Hundreds more were arriving ­every hour, even though the prime minister warned that the nation of 4.2 million could handle no more.

Some asylum seekers were shipped to Hungary. More made their way to the porous border with Slovenia, where they tried to sneak across the frontier through forests, fields and streams.

In Bregana, a verdant village on Croatia’s border with Slovenia, hundreds of Iraqis, Syrians and others were gathering in a bid to cross the frontier, after which they would be in the borderless part of the European Union. They came by taxi, bus and on foot; some Croatians picked people up by the side of the road and took them up to the border for free. When a crowd tried to take a footpath into Slovenia but was turned back, ­Croatian police guided them to another crossing where they said they might have more success.

Slovenian authorities have refused to allow them in, although Prime Minister Miro Cerar said late Friday that a “corridor” through the country could be possible if the pressure of new arrivals becomes too great.

For families who set off weeks ago from Iraq and Syria with a clear plan to cut through now-closed Hungary, the detour through Croatia was forcing a ­rethink on the fly. Much of Slovenia is mountainous, and the onward path is forbidding.

Mixed reception

“Our problem now is that our smartphones aren’t working, so we don’t know exactly where we are or where we’re going,” said Bassam, 38, a lawyer from Aleppo, Syria, who left home a month ago with his wife and two daughters, ages 3 and 5, in hopes of reaching Germany.

Bassam, who withheld his full name for fear of reprisals against relatives back home, said he and his family asked a taxi in Zagreb, Croatia, to take them to the border. But he said they did not know how they would make it to their final destination.

“This is where the taxi driver dropped us off. I have no idea,” he said, as his daughters snacked on Oreos on a blanket they had spread on the grass in a park near the border.

Many of the migrants said the once-honed system to get route information on their smartphones had broken down after they entered Croatia, closing off Google Maps, Facebook and WhatsApp, their typical communication tools. Locals were giving them advice.

There was a mixed reception in Bregana on Friday, as residents of a nearby apartment complex brought pots of stew and rice to the migrants and allowed some to use their bathrooms, since there were no other facilities in the ­vicinity. As the crowd of migrants multiplied, some passing cars honked, waved Croatian flags and made thumbs-up gestures. Other drivers waved middle fingers.

Croatian Prime Minister Zoran Milanovic said his country could no longer accommodate refugees, although he said they were still welcome to pass through on their way to northern Europe.

“Croatia has shown that it has a heart,” Milanovic said, “but we must remind our neighbors and the E.U. that we also have a brain, and that we know where our interests and our security lie.”

Croatia closed all but one of its border crossings with Serbia late Thursday, raising fears that some migrants could be tempted instead into traversing fields between the nations. Many of those areas are strewn with land mines, a legacy of the Balkan wars of the 1990s.

The efforts to rid Croatia of the new influx of migrants sparked a border incident on Friday, when at least 36 Croatian police officers rode a train packed with asylum seekers into Hungary. Zoltan Kovacs, a spokesman for the Hungarian government, called it a “major violation of international law.”

After being detained for hours, the police were returned to Croatia. Croatian authorities said there had been an agreement with the Hungarian government, something Kovacs denied.

Policy indecision

In recent days, each nation has been left largely on its own as E.U. leaders struggle to find a common strategy to the refu­gee crisis. The indecision has drawn harsh reprimands from refugee advocates, who say that Europe’s failure to make a plan is taking a human toll.

The U.N. refugee agency says that more than 442,440 people have reached Europe this year on sea routes from Turkey or North Africa, and 2,921 have died along the way.

Hungary on Friday started to build a new razor-wire fence along its border with Croatia, adding to the 108-mile span along its Serbian frontier. The new effort, announced by Hungary’s anti-
immigrant Prime Minister Viktor Orban, is an attempt to force back refugees who might try to bypass the fence facing Serbia. That border was sealed earlier this week and became the scene of clashes.

“There will be no dune, no molehill to hide behind for anyone to hope to enter the territory of Hungary illegally,” Orban told Hungarian state radio Friday.

The stubborn response has infuriated the leaders of nations that are shouldering far more of the burden.

Central and Eastern European countries have blocked E.U. attempts to spread asylum seekers throughout the continent. But Germany alone expects to take in 800,000 asylum seekers this year, and possibly up to 1 million.

The disparity has some German leaders suggesting that they should force the wayward E.U. ­nations to take in refugees. Imposing requirements by majority rule, rather than by consensus, is an option under E.U. law, but it has never before been used for an ­issue of such sensitivity.

“It cannot be that Germany, Austria, Sweden and Italy bear the burden alone. European solidarity does not work that way,” German Foreign Minister Frank-Walter Steinmeier told Germany’s Passauer Neue Presse newspaper.

E.U. leaders will meet Wednesday to discuss the crisis.

Birnbaum reported from Brussels. Marica Rakicevic in Zagreb contributed to this report.

Read more:

Germany’s enthusiasm for refugees might not last. These maps explain why.

Refugees get a chance to wash and rest their weary soles in Budapest

Read The Post’s coverage on the global surge in migration