Zain al-Abideen Majid’s father lifts him over a coil of glittering razor wire in the moonlit darkness of a Serbian farm, stretching to hand the boy to a relative on the other side.

Though Zain is only 4, this is by no means his first surreptitious border crossing, and he remembers his father’s admonition at the very start of their journey, when they slipped from their homeland of Syria into Turkey: Don’t make a sound, or the guards will beat us.

On this night, as Zain is passed over the wire from Serbia into Hungary, the barbs rip two bloody gashes in his right shin, like the flicks of a scalpel.

He stays silent.

Zain was born in Syria as the fighting there was beginning. Ever since, he and his extended family have been living in the shadow of conflict, surrounded by a chaotic mix of fear, threats, extortion and kidnapping.

This summer, Zain, his father, Ahmad Majid, and a band of determined relatives — eight adults, including Zain’s pregnant mother, and five other children, a baby and a toddler among them — became part of a remarkable chapter in human migration.

Over nearly two months, the family journeyed from Syria through Turkey and eight European countries, through much of the trip not even sure of a destination. The group was cheered and cursed, encountering the best of Europe, and the worst. They endured exhaustion and despair, stranded for five days in a train station in Budapest and imprisoned in Denmark with seemingly no hope of moving forward. And they had moments of triumph, outwitting border guards and benefiting from the camaraderie of fellow travelers.

“It’s better than dying,” says Ahmad.

The sheer number of people trudging alongside them has often led to impersonal descriptions: a wave, a mass, a crisis. But up close they were very much individuals living through an unsettling and sometimes terrifying journey. For the Majids, that journey took them from the olive groves of the village in Syria that had nurtured their family for generations toward an uncertain future in an alien culture.

For much of the trip, I traveled with them, along with a team of other journalists from The New York Times, documenting their joys and sorrows, and sometimes becoming part of their experience.

The Majids are a tight-knit family, resourceful and relatively well off. For years, Ahmad cautiously plotted how best to survive in Syria, even as it was deteriorating and splintering into fiefs run by rival warlords and militias. Prosperous and with considerable social standing, he had many reasons to try to wait out the violence and upheaval, even as it threatened his family more directly.

When he did leave, reluctantly and after long deliberation, he and his family were swept into a stream of humanity, and forced to improvise at every step. He faced wrenching decisions about keeping the family together. He weighed the odds of maintaining his family’s physical safety, worried about the effects of the trip on his children. He went into debt.

Behind him, he left a lifetime of expectations and assumptions. Ahead, he saw security and opportunity. Yet he had little idea of how he was going to get there, no sense of the challenges or setbacks he would face along the way or the specter of disillusionment waiting for his family at the end of their journey.

No Second Thoughts

To one side of the railroad tracks in Idomeni, Greece, near the border with Macedonia, a group of about 20 people rest on the ground under a spreading shade tree, one day in late August. Standing in the middle, examining his cellphone, is a man in an orange shirt, at 6-foot-2 appearing unusually tall among the other refugees.

This is Ahmad Majid and he stands out, not just for his height, but also for his air of command, his detachment, and the small village of men, women and children that appear to be following him. His brow is often knitted in an expression of apprehension, even when he smiles.

I begin chatting with him, the first in what will be weeks’ worth of conversation, in which he and his family gradually entrust me with the details of their lives and allow me to witness their struggle to maintain hope, pride and dignity over their long journey.

They have already traveled a long way by the time I meet them. Four days earlier they had crossed the Aegean from Turkey to Greece, with Ahmad helping to navigate. They show me a cellphone video of them bouncing across the waves in a sturdy rubber boat with a good motor. In the video, they are wearing life jackets and laughing.

Ahmad’s wife, Jamila Khalil, 22 and head-turningly pretty, with pale skin and a faraway look that conjures Vermeer’s “Girl With a Pearl Earring,” says the boat ride was the easiest part of the trip. Even after a harrowing journey out of Syria, they are still eager and to a large degree naïve.

Edremit ... where the group waits three days for a boat. On Saturday, the family leaves for Lesbos by dinghy. Turkey Mytilene LESBOS The group travels to Edremit ... GREECE Then the group takes a government-chartered ferry to the port of Piraeus in Athens, about 12 hours away. The family arrives in Izmir on a Tuesday, Aug. 18. To Athens Izmir Aegean Sea Edremit ... where the group waits three days for a boat. On Saturday, the family leaves for Lesbos by dinghy. Turkey Mytilene LESBOS The group travels to Edremit ... GREECE Then the group takes a government-chartered ferry to the port of Piraeus in Athens, about 12 hours away. The family arrives in Izmir on a Tuesday, Aug. 18. To Athens Izmir Aegean Sea The family travels to Edremit, where the group waits three days for a boat to Lesbos. Turkey LESBOS GREECE Aegean Sea Then the group takes a government-chartered ferry to Athens, about 12 hours away. The family arrives in Izmir. By Derek Watkins; Satellite image by NASA/USGS Landsat.

The reality of what they would face in Europe became apparent only after they landed on the Greek island of Lesbos. There was no shelter awaiting them or the thousands of others streaming there. They slept on the street, and had to walk more than a mile to use a bathroom in a public park.

By the time the family reached Idomeni in late August, refugees were well on their way to carving a trail through Southern and Central Europe toward the prosperity of Germany and Scandinavia. National governments, caught off guard and worried about anti-immigrant sentiment, initially reacted slowly and inconsistently to this migrant torrent. Just before the Majid clan’s arrival in Idomeni, Macedonia had closed its border with Greece and then reopened it, opting, like other nations along the route, to keep the stream of people moving as fast as possible through its territory and on to the next country.

Even then, Jamila, who at this point is six months pregnant, says she has no second thoughts. “I wanted to go away from Syria,” she says, “and deliver somewhere else.”

The Lives Left Behind

Once they cross into Macedonia, refugees are put onto trains that will take them to the border with Serbia. The Majids board a train that evening, Aug. 26, around 6. It is packed, and the family shoehorn into the blue-vinyl bench seats, adults taking the children on their laps to make more room. Ahmad plays a counting game with his 7-year-old daughter, Widad, and high-fives her each time she gives a correct answer.

I start to piece together the family’s story.

Ahmad, 30, is a natural leader who charms strangers and gains their trust with his good looks, confidence, air of authority, easy laugh and affectionate way with children. His brother Farid, 35, burly, with darker hair and sunken eyes, is more street-smart and cynical, a behind-the-scenes presence whose counsel Ahmad has always sought before making a decision. Together they ran a small clothing factory in Aleppo, making and exporting jeans, shirts and sweaters to Iraq.

The factory was looted by forces on both sides of the Syrian civil war, they say, and at the beginning of 2013 they were forced to close. They retreated to their ancestral home, a stone house where they had always spent part of the year, in the small farming village of Ereb Werane, in Afrin. It is less than two miles from the Turkish border and about an hour’s drive north of Aleppo, before military checkpoints choked off the road. They are Sunni Kurds, from a prominent clan, the Rashwans, they tell us, and held an honorary title: “aghawat,” a privileged landowning class.

The Majids’ relatively secular lifestyle made them a target of Islamic fundamentalists. The women wore pants and no veils. Ahmad fasted during Ramadan but drank beer at other times. The fundamentalists called them “kuffar,” unbelievers.

“We are in the middle and everyone is against us — the Turks, ISIS, al-Nusra, the Free Syrian Army, even the Kurds are harassing us to fight and pay taxes,” Ahmad says of those days.

Their sophisticated lives devolved into a world of forcible conscription into militias, domination by warlords and the threat of violence and kidnapping. The warlords imposed tributes, like taxes on olive oil (the family also owned olive trees and an olive press), wheat, anything valuable.

“They say they’re fighting for us and protecting us, and we have to give them everything we have,” Ahmad recalls. “They take young people and just brainwash them; give them weapons, tell them they want to give them a car. These are kids — 14, 15 years old.”

Ahmad favored leaving; Farid argued that they should wait — the war could not last forever. In the fall of 2013, they bought a house across the border in Gaziantep, Turkey, as a safe haven, should they need one.

The deciding jolt came in the summer of 2014. Farid was kidnapped — to protect relatives left behind they would not say who did it — and they were forced to sell the Turkey house to raise the $120,000 ransom. At that point, staying began to seem much riskier than leaving.

Ahmad originally planned to make the trip alone, then apply for family reunification, but his mother objected, saying they should not risk the family being split up.

So the three eldest brothers, Ahmad, Farid and Mohammad, 36, decided to go together, with their wives and children. Three months before they left, however, their plan fell apart. Mohammad’s oldest son, Nabih, who is 9, developed welts on his body. At first they thought he had had an allergic reaction to a hunting dog. But tests showed it was a potentially fatal blood cancer.

They had to take him to Turkey for treatment. But he was given second-class care, Ahmad said. When the beds were full, the hospital would postpone his chemotherapy so Turkish citizens could go first.

The family wanted to take him to Europe, but the doctor said his immune system was too weak. So his parents stayed behind with him and his younger brother. But Ahmad and Farid took Mohammad’s daughter, who like Zain’s sister bears the family name Widad. She is a wide-eyed, round-faced girl of 11 with a thick braid hanging down her back. She has not been told her brother has cancer.

The Majids had once been able to travel relatively freely between Syria and Turkey, but by the time the family decided to leave Syria for good, Turkey had closed the border to Syrians, forcing the Majids to sneak across. Farid and his family went first. It took Ahmad’s family two tries to make it.

During the first attempt, on July 15, they heard someone being beaten so badly by border guards that he could not make intelligible words, and Ahmad decided to retreat. They tried again on July 21.

This time he contracted with a smuggler to bribe the border guards, $100 per adult, half-price for the children. They told Zain not to make any noise, and crossed into Turkey just after midnight with a large group.

On the train through Macedonia, I ask Ahmad if he thinks he will ever return to Syria. “Inshallah,” he says: God willing. Then he turns his head and looks out the window, trying to hide the tears he is wiping off his cheek.

In the Crush

When night falls on the train through Macedonia, people without seats sack out on the floor and in baggage compartments, leading to jokes about how they are always sleeping in five-star hotels. News photos often show the migrants sleeping, and there is some truth to that. Sleep deprivation is a constant element of life spent in motion at all hours of the day and night, and everyone learns to rest whenever the opportunity presents itself.

The Majid brothers receive a cellphone picture of their sick nephew. It shows a sad-eyed boy in a red shirt, bald from chemotherapy.

The train arrives at the Serbian border just before 11 p.m., and most of the refugees will not sleep well for the rest of the night. Babies cry as they are woken.

A volunteer hands out plastic-wrapped hamburgers. Vendors — another constant — sell blankets, soda, cookies and water.

The refugee processing center on the Serbian side is several miles away. Among the refugees is a boy in a wheelchair.

Many of the refugees find the distance impossible at this hour and simply bed down for the night on the pavement. The Majids walk for a while, then pitch their tent. In the morning, they come upon taxis and pay 100 euros for one to take Farid to the camp with the women and children.

Ahmad and the young men plan to walk, but are picked up by a relief agency bus that has recently begun plying the route. Meanwhile, the taxi driver, not the last of the unscrupulous people they will encounter, dumps Farid and the others after less than two miles. But Ahmad spots them in a field, and the relief agency bus rescues them.

Long lines of refugees stand in the blistering sun outside a rusting fence, begging guards to let them into the Serbian reception center, on the outskirts of Presevo. Refugees have no choice but to register if they want to travel farther through Serbia. Countries like Greece, Macedonia and Serbia recognize that few if any of the migrants want to stay in those countries because of the poor economic prospects. So they have come up with a system that gives the refugees the legal right to pass through, without necessarily applying for asylum. In Serbia, they register to stay in the country for 72 hours, gaining the right to travel, and even to stay in a hotel.

It is like the “letters of transit” in the movie “Casablanca,” which allowed the bearer to travel through Nazi-occupied countries. Without that piece of paper, they were stuck.

In the camp, refugees stand in various lines to have their bags searched and their paperwork processed. I am permitted inside the fence for 15 minutes and see uniformed guards holding thin switches. Later, several refugees complain angrily that the guards use the switches to hit people who do not do as they are told.

Ahmad answers a call by the guards for volunteers to keep order. The volunteers are given switches, but he refuses to use his and tells the others not to beat anyone — because they are all Syrians, he says later.

In the camp, Ahmad says, women and children are given two cans of sardines per person, a half-round of bread, a small bottle of water and a croissant. But the men, he says, are not fed. His family had to wait 11 hours for their papers. During that time, he says, he shared his family’s rations, but many single men, including three of his relatives, are so hungry that they go outside the fenced area to get food, and then are not allowed to return to complete their registration.

Presevo is like a whistle-stop town in the Wild West. The main street bordering the camp teems with refugees and the hustlers and merchants who profit off them. The two cafes across from the camp are doing booming business. The local seller of Serbian SIM cards is making a mint from refugees, who buy new phone and data cards in every country; he jokes that after this, he is going to retire.

Communal Spirit

After spending the day registering in Presevo, they are placed on buses to Belgrade, the Serbian capital. They arrive there at 6 a.m. the next morning, Aug. 28, and are deposited at a public park. Like parks in major cities across Europe, it has become a refugee tent city. People are just waking up, washing their faces and clothes in the public fountains.

Maintaining some sense of dignity is an ongoing struggle. This is a world of fetid portable toilets and communal sleeping. Volunteers and authorities approach them wearing masks and gloves, as if they are diseased. The refugees are often accused of leaving behind piles of trash, though there are usually no trash cans at the railroad tracks and border crossings where they gather in large numbers.

Ahmad, who fastidiously puts on a clean T-shirt each morning, leaves his family in the Belgrade park and sets off in search of a hostel where they can rest, shower and do laundry. But to rent a room for €15, about $17, per person, they need Serbian letters of transit for everyone, and the three young men in the group traveling with the Majids do not have them.

In a display of the communal spirit that generally prevails among the refugees — back on Lesbos, the Majids gave away one of their two tents to a family with four children who were cold and wet — they borrow papers from another group in the park.

At the Razor Wire

In Belgrade, they are tantalizingly close to Western Europe. Almost as if superstitious about wanting too much, the Majids had started out saying they would be happy almost anywhere. Then they began talking about going to Germany. Now they are becoming confident enough to talk about going to Sweden. In the group is Ahmad’s cousin Nisrine Majid. Her brother lives near Malmo, a city with a large immigrant population; he arrived there a year earlier via the more dangerous route, going to Libya and then across the Mediterranean to Italy.

But their next hurdle will be Hungary, where open hostility to migrants has led to construction of a border fence. On top of that, the discovery of the bodies of 71 migrants decomposing in a truck southeast of Vienna has by this point prompted renewed calls to clamp down on the migration.

Ahmad weighs his options. To get from Turkey to Greece, they had used a smuggler, a former employee of the Majids in Syria. The smuggler now offers to get them to Austria for €1,350 per adult, with a discount for the children.

But with 14 people in the group, Ahmad decides he cannot afford the smuggler’s price. So he has to sneak his family past the razor wire at the Hungarian border. He makes a flurry of calls to Syrians who have already made the passage, seeking advice. You will see two towers, one tells him. Walk between them, they are not manned.

They catch a bus to Kanjiza, a border town that houses a refugee camp, at 3 p.m. on Sunday, Aug. 30. One bus after another pulls out of the Belgrade bus station at about the same time, making the same trip.

The bus tears down a two-lane country road at top speed. A steeple rises above every village, and farmers drive horses pulling wagons filled with hay. Ahmad looks through the bus windows at the fields of cornstalks and sunflowers and sees not the picture-postcard view that a tourist might register, but the promise that they can hide among the crops if necessary.

As the bus approaches Kanjiza, their enterprising bus driver offers to continue on to Horgos, closer to the border, for another €5 per seat. The Majids agree, and take the children on their laps. After letting out half the passengers, the driver fills the rest of the bus with other refugees willing to pay.

They reach Horgos around twilight. As they walk along the railroad tracks toward the border, one of the refugees, an old woman with a gimpy leg, blithely picks yellow wildflowers, as if out for a picnic. Her daughter chats in rapid-fire English about wanting to join her fiancé living in England.

They veer off into a freshly plowed field of powdery brown earth, which smells faintly of manure. The children pick plums while the women nestle down to rest. Someone’s cellphone sounds a call to prayer. Groups of refugees walk past them in the dusk without exchanging a word, as if, by silent agreement, they have decided it is better not to speak.

Two towers loom beyond, as described by Ahmad’s phone contact, one in Hungary and one in Serbia. It is the second night of the full moon, which rises orange and casts a neon glow over the fields.

Around 10 p.m., Ahmad’s brother Farid and a cousin find a weathered wooden extension ladder and take it to the border. Those in light clothing change to dark, and everyone creeps forward. The border is marked by a trench, deeper than a man is tall. It is wet at the bottom, screened by bamboo and shrubbery on the Serbian side, and blocked by coils of new-looking silvery razor wire on the Hungarian side.

... to here, where smugglers offer a ride to Budapest, about 100 miles away. HUNGARY Train tracks The family makes its way through forest and fields ... Roszke The group waits until nightfall before crawling under a razor-wire fence, avoiding frequent border patrols. International border SERBIA On Monday evening, Aug. 31, the family walks along the train tracks from the Serbian town of Horgos. Horgos ... to here, where smugglers offer a ride to Budapest, about 100 miles away. HUNGARY Train tracks The family makes its way through forest and fields ... Roszke The group waits until nightfall before crawling under a razor-wire fence, avoiding frequent border patrols. International border SERBIA On Monday evening, Aug. 31, the family walks along the train tracks from the Serbian town of Horgos. Horgos HUNGARY Here, smugglers offer a ride to Budapest. Train tracks After nightfall the grpup crawls under a razor-wire fence, avoiding border patrols. International border SERBIA On the evening of Aug. 31, the family walks along the train tracks from the Serbian town of Horgos. By Derek Watkins; Satellite image by DigitalGlobe via Google Earth.

A border patrol drives back and forth along a road on the Hungarian side every 15 minutes or so, and the car sometimes pivots to point its headlights directly into Serbia, as if it knows someone is there. When it does, everyone in the group falls flat on the ground behind the bamboo.

A helicopter circles overhead. Now and again, Farid’s 8-month-old baby, Widad, fusses, and his wife, Roujin Sheikho, stuffs a bottle in her mouth to keep her quiet. In a striking display of empathy, no one shushes the baby or scolds her mother. It is like a war movie, only real.

The men scout several spots, laying the ladder over the razor wire like a bridge, and at 1 a.m., Farid and two of the young men scramble across. As the women and children begin descending the embankment to follow, the police spot them and come running and shouting. Family members scurry back, and Ahmad stays behind to distract the guards.

“Please, Mister. Please, Mister,” he says, pacing back and forth below, raising his hands in surrender. “I have baby.” The guards look down at him and at the farmer’s ladder and laugh uproariously.

After Ahmad retreats, the cat-and-mouse game begins again. As everyone waits, a separate group of some 15 men dash out of the trees to the same spot and slip under the wire, eluding the police. The officers move their car to the point where the men have crossed.

Ahmad motions his group back to a spot they had tried earlier. At 3 a.m., they descend into the ditch in single file, slosh across and climb up the other side. The men leverage the barbed wire with a tree branch, and the adults crawl under while the children are handed over. The lame old woman snags her dress but manages to wriggle through. Ahmad passes his boy, Zain, over the wire and waits for everyone else to pass. He is the last to cross.

At 3:12 a.m., they have vanished into the woods across the way.

Lost Laughter

They spend the rest of the night hiding in a farmer’s field. In the morning, one of the many opportunists who appear along the migrant trail, a blond woman in a peach dress, comes into the field looking for customers, knowing some migrants are likely to have made it across. The Majids agree to pay €2,500 for three cars to drive them two hours to the Keleti train station in Budapest.

The Majid men settle down on their blankets in the station’s underground concourse. Shoes neatly piled to one side, they smoke Gauloises and play Trex, a Middle Eastern card game, to pass the time. A group of Hare Krishna devotees play their drums and cymbals and sing and dance nearby. Ahmad tries to charge the solar battery for his cellphone under the skylight.

Men without mirrors lather one another’s faces and trade shaving services.

Farid warms up to us only slowly and does not smile easily. But he has discovered that I drink espresso, and he brings us each a cupful several times a day. I never do figure out where he gets it from.

Farid has a habit of slinging his toddler, Silva, over his shoulder and carrying her everywhere. It seems strange until Ahmad tells us that Silva, once a bubbly baby and the favorite of her grandparents, has changed. They blame the Turkish border crossing. Turkish soldiers fired over their heads, and Silva, about 18 months old, opened her mouth to scream but no sound came out.

They have been trying to make her laugh ever since.

Rules in Flux

Though my journalist colleagues and I spend much of our time with the Majids and other refugees, we are able to sleep in hotel rooms when we want to. We have valid passports. We know that at any moment, we have the option of pulling out and going home. Those facts create an inescapable distance between us and the Majids.

But there are moments when the distance narrows or even disappears amid the intensity and distress of the voyage. One such moment comes soon after our arrival in Budapest. The government of Prime Minister Viktor Orban has been allowing refugees who have made it this far to move on to Austria and then Germany.

The refugees seize the chance, and those who want to buy multiple train tickets face lines running the length of the station. Non-refugees can walk into a glass-fronted ticket office.

Ahmad asks if I will buy the family’s tickets to Berlin, promising to pay me back. I know that to say yes would be to cross a line that journalists do not like to cross, from observer to participant. But this is a desperate family that has helped us at many points along the way, right down to sharing food with us and taking offense at our attempts to say no.

Flashing my United States passport, I am whisked to the front of the line, where I purchase the tickets. The woman behind the counter gives me a withering stare. “I have a family,” I add.

The woman hisses something to a nearby police officer that sounds like “migrants.” The officer shrugs. I try to look nonchalant. “No refunds,” she says, in what I take to be a final attempt to dissuade me from purchasing tickets for the following day.

Overnight, though, there is a fresh complication. The rules of the game have changed and train travel is cut off for anyone lacking proper documents. The Majids are barred from boarding, the tickets wasted. My effort to help has gotten them nowhere.

Hope at a Hurdle

On Friday, Sept. 4, the train station is abuzz with people trying to hire smugglers. They pass around a printout in Arabic, taken from a Facebook site. It lists the nicknames, nationalities and phone numbers of smugglers, like “The American,” or “From Ahvaz,” a city in Iran.

We have been in Budapest five days now, longer than in any other place on the route. Ahmad’s former-employee-turned-people-smuggler tells him it is too dangerous to move. “The border is so closely watched, not even a bird can fly over,” he says.

In the middle of all the hubbub, a wild-haired man threads his way between the blankets. Over a bullhorn, he exhorts refugees to get up and walk to Austria, days away. He is trailed first by TV cameras, then by a growing line of young men carrying sleeping bags. Ahmad has an impulse to join in, but he has made a deal with a Romanian smuggler to get them to Germany for €300 per person.

The problem is that their cash has run out. Desperate to get out of Hungary, the Majids decide to borrow some money until they can sell a piece of property in Syria, and to have the amount transferred to Budapest through a hawala network, a money transfer system that relies on trust and connections.

Ahmad is nervous that if he leaves the station, he will be caught and fingerprinted by the police, which could mean being forced to stay in Hungary. A Kurdish Syrian with an Austrian passport, in the station visiting relatives among the refugees, agrees to go for him.

The Austrian rings the bell at a “Money Change” office in a vintage lime-green building in downtown Budapest. A Hungarian man wordlessly leads the way down one street and into another, then drops us off at a cramped, unmarked office with a receptionist at the front door.

The hawala broker sits behind a desk in a separate office at the back, surrounded by security monitors and a television feeding a constant stream of prayer services from Mecca, Saudi Arabia.

He is Syrian, he says, and has lived in Hungary for 25 years. He takes out €6,000, divided into three equal stacks of €20 bills, and runs them through a counting machine. Then he puts the bills in an envelope and hands it over. There is no receipt.

When the Austrian returns with the money, the Majids, however, are dejected. The smuggler has stood them up for someone else who has made a better offer.

Instead it is the wild-haired man who bails them out. He has attracted about 1,000 marchers, paralyzing traffic on the highway to Austria. A few hours later, yielding to the marchers, the Hungarian government organizes bus transport to the Austrian border. It is after midnight when the Majids pick up their backpacks and say goodbye to the yellow tent they have had with them since Lesbos. They will not need it anymore.

They walk out of the train station and into a light drizzle to board a bus. The city lights sparkle as we drive slowly across the Danube and into the night.

Daring to Dream

Arriving in Vienna on Saturday, Sept. 5, Farid’s wife, Roujin, and his cousin Nisrine, take off the white head scarves they have been wearing. Jamila, Ahmad’s wife, paints eyeliner across her eyelids in two Brigitte Bardot-like swoops. Nisrine’s brother drives from Sweden to pick her up. She was a last-minute addition to the trip, and they are not sorry to see her go; they have quarreled with her over the last few days.

The refugees are calling the German chancellor, Angela Merkel, “Mama Merkel” for being so welcoming, and the Majids quickly reach Munich before moving on to Hamburg the next day. When they identify themselves as refugees, they are allowed to ride the train for free.

On the train, they talk about what drove them out of Syria. About their hopes of giving their children a better education than what they could get in Syria. About building a new life.

Ahmad and Farid say they plan to open a Middle Eastern supermarket once they settle in Europe. Or maybe it will be an Arab bakery, serving immigrants like themselves. They admit they don’t know how to bake.

“It’s not about that, it’s about management,” Ahmad says. “Farid and I don’t know how to sew a pair of jeans, but we are good managers.”

But having reached Germany, where bystanders applaud them and they can apply for refugee status and live legally, they decide to push on, having concluded that Sweden is the best destination for them.

After 18 Emojis

We have barely crossed the German border into Denmark, en route to Sweden, when the police stop our train and remove all the migrants.

About 100 passengers, including the Majids, are taken to an unused school in Padborg, down the street from a “Discount Sex” shop.

They have had the bad luck to arrive on the same early-September day that the center-right minority government of Denmark has begun running ads in Lebanese newspapers, essentially telling refugees not to come, that social benefits are being cut and asylum rules stiffened.

The police herd the refugees into a school gymnasium, where they are fed lasagna and given foam mattresses to spread on the floor. Red X’s are inked on the backs of their hands.

After a sleepless night, Ahmad and Jamila fall asleep with Zain between them. It hurts them to know that Nisrine, Ahmad’s cousin, who barely said goodbye, has made it to Sweden. The next day, as the Danes continue plucking refugees from trains, Ahmad, Farid and their families are taken out of the school and driven to a prison 50 miles away. A police spokeswoman, Lisa Dissing, says the family was moved to separate it from a less cooperative group of refugees.

The two families are locked in separate cells. Ahmad worries that his brother will relive the trauma of his kidnapping in Syria. Ahmad records the prison scene on a cellphone video, saying bitterly that the Syrian people would be better off risking barrel bombs at home than coming to Europe.

Ahmad remembers being offered some milk for the children, but they refused to eat.

Related Coverage On Migrant Trail, Melding Words and Images How a reporter and photographers worked together to capture the daily struggle of Syrian refugees on the march through Europe. Read More >>

The next day, they are taken back to a police station in Padborg. They ask for food for the children. Ahmad says they are given five sugar cubes, one for each child but the baby.

They are so outraged that they tell the police they would never want to live in Denmark. “My son now knows the meaning of the word prison because of you,” Ahmad says he told them.

The police warn them that if they return to Denmark they will be imprisoned, and drop them off at the German border, where they head back to Hamburg to seek asylum.

While the Majids are being held, several hundred migrants break out of the Danish school and start walking to Sweden, and I go along, interviewing people at the back of the pack. In one of those moments that gives me a small taste of what it might be like to be in a migrant’s shoes, the police push me and about 30 other stragglers to the ground. Despite my protests, I am put in a bus and returned to the school. A female officer marks the back of my right hand in blue pen: 1919.

Eventually I just walk out of the school.

Overnight — too late for the Majids — the Danish police reverse course and say they will let migrants pass through Denmark to Sweden.

But word of the Danish about-face rekindles the Majids’ determination to get to Sweden. In Hamburg, they pick up once again and move.

This time, still smarting from their humiliation, they bypass Denmark and cross by boat from Rostock, Germany, to Trelleborg, Sweden. At 9:22 p.m. on Saturday, Sept. 12, Ahmad sends a joyful WhatsApp message, “We are now in Sweden,” in Arabic, accompanied by 18 emojis: 13 smiley faces, three winking faces and two faces with hearts for eyes.

It has been unbearably hard, Ahmad later says, though he initially expresses little concern about the future. The family adopt Swedish spellings of their names and observe Eid al-Adha with a picnic in the woods. “I can meld with the Swedish people,” he says.

A few weeks later, he seems much less upbeat. Speaking by phone from the refugee center where his family is staying, he tells me their days are spent in enforced idleness. There is no school or organized activity for the children. The promise of Swedish lessons has not materialized.

He is frustrated that their asylum interview is three months off. His wife, Jamila, is set to give birth in November, and had to wait a month before she could see a doctor.

When he complained, he says, he was told, “We didn’t ask you to come here.”

The last time I speak with him, he says that if things were better in Syria, he would go back tomorrow.