As Mohanad walked down an abandoned railway line that would lead him from Serbia to Hungary on Sunday, he sucked in his breath and prepared for the worst.

Among refugees, the word Hungary has become a byword for trouble.

There’s the razor-wire fence. And the police force with the thuggish reputation. Not to mention the government that has made abundantly clear it wants to keep the refugees out at all costs.

“It’s scary there,” Mohanad, a peach-fuzz-faced 18-year-old, said as he neared the border. “I’ve heard that if they catch you crossing, the police will beat you.”

But when the Syrian refugee set foot on Hungarian soil, walking past a pair of police officers who barely glanced in his direction, he let out a laugh.

“That’s the fence?” he asked, pointing to a low coil of razor wire resting limp on either side of the tracks. “I thought it was two meters high. It’s so easy to cross.”

Thousands of others discovered the same thing Sunday, with an unending stream of humanity pouring across a border that Hungary’s nationalist leader has threatened to make impregnable in just nine days.

As of Sunday, it was barely an obstacle, suggesting that Prime Minister Viktor Orban has a long way to go to turn his hard-line rhetoric into reality.

Orban’s attempts to crack down on the tens of thousands of refugees transiting through his country en route to the wealthier nations of Western Europe havebackfired embarrassingly in recent days.

When he attempted to block migrants from leaving the country without registering with authorities, more than 1,000 men, women and children launched a spontaneous march to the Austrian border that forced the government into an abrupt late-night retreat.

But unlike that plan — which had the paradoxical effect of temporarily forcing migrants to stay when neither they nor the government want them to be here — Orban’s ambition to lock migrants out is in line with his worldview.

The prime minister has argued passionately that it is important “to keep Europe Christian” and to end the flows of hundreds of thousands of mostly Muslim migrants who have arrived on the continent this year after fleeing war, oppression and poverty in the Middle East, South Asia and Africa.

The most popular route into Western Europe for those migrants runs north from Serbia into Hungary. Orban has vowed to close it off by Sept. 15.

To do that, he has shown a willingness to go to extreme lengths. The prime minister has drawn international condemnation for erecting the fence, the first phase of which was completed in recent days. The next phase — making it substantially higher — is due to be finished in November.

Orban is also ramming legislation through Hungary’s parliament that would impose stiff prison sentences on anyone who damages the fence or crosses it illegally. Over the weekend, he said he would support sending in the army to enforce the new law.

“The big changes will come after September 15, and we’ll bring the border under control step by step,” Orban said Saturday at a news conference. “We’ll send in the police, then, if we get approval from parliament, we’ll deploy the military.”

Without strict controls, he said, Europe will be overwhelmed by “tens of millions” of migrants.

Yet for all of Orban’s bluster, the scene that played out Sunday revealed how difficult it will be to clamp down on a jagged 110-mile border that runs through forests and farms, with no natural geographic boundaries to separate one country from the other.

Before Mohanad, the 18-year-old, realized the police had no intention of arresting him, he and a group of friends considered other options. “Maybe we should just walk through the field,” one proposed, pointing to an expanse of sunflowers just steps from the tracks.

Many others did that, not trusting that authorities wouldn’t try to detain them.

But Mohanad, who declined to give his last name, opted to follow the crowd as it stayed on the tracks and paraded directly into a police-run reception center half a mile north of the border.

There, volunteers handed out food, water, diapers and baby wipes to grateful and exhausted refugees who said they had been walking for days through Serbia. The volunteers encouraged the refugees to move on to a nearby registration center where they would spend the night while police carried out criminal background checks.

“You’ll have a place to sleep and three meals a day,” a bearded British volunteer reassured a woman with tired eyes whose toddler’s face and hands were covered in the gooey remnants of a gifted candy bar.

“Fingerprints?” the woman asked plaintively.

The volunteer was reassuring: She wouldn’t have to formally record her presence in Hungary, a step that refugees arriving here are terrified will doom their chances of settling in a country farther north because of a quirk in European Union rules that dictates they should claim asylum in the country they first enter.

“Don’t worry,” he said. “Germany’s not going to send you back.”

A spokesman for the U.N. High Commissioner for Refugees, Erno Simon, said police at this particular center did not have the capacity to formally document the refugees’ arrival. “It’s compulsory. But it’s not happening in real life,” he said. The number of people arriving had surged in recent days, he said, and the authorities “are not really prepared.”

But there were some signs that is changing. The registration center — with rows of neatly arrayed green tents and a capacity of 1,000 — opened for the first time Sunday.

For now, the facility is being used to house the refugees while police run criminal checks. “It’s not a detention facility,” said Szabolcs Szenti, a police spokesman.

But with its 12-foot fences topped by barbed wire, it could easily be converted into one.

On Sunday morning, about 50 refugees who had arrived in Hungary hours earlier sat in the dirt outside the center, waiting to be admitted. Stern-faced police officers swarmed around, some leading German shepherds who snapped and growled as they strained at their leashes.

“They told me to go here,” said Mustafa, a weary-looking Syrian who declined to give his last name. “But nobody knows what’s inside.”

Andras Petho contributed to this report.

Read more:

Europe struggles to handle accelerating flow of refugees

Iraqis join the growing flow of refugees to Europe from Turkey

Today's coverage from Post correspondents around the world