From a Budapest hilltop overlooking a panorama of central Europe, Jean-Paul Apetey reflects on how far he's come, how improbable and unexpected his journey has been — and yet how many miles he still must go.

The 34-year-old from Ivory Coast has spent years searching for a new life. He has piloted a migrant-packed boat from Turkey to Greece even though he'd never been at sea; lost his belongings evading police during a 200-kilometer (125-mile) trek through Macedonia; escaped from a band of Bangladeshi smugglers beating and raping his fellow travelers; stared down knife-wielding thugs in Serbia; and reached Hungary thanks only to an unlikely act of kindness from a Frenchwoman who fancied his dreadlocks.

Apetey and the dozens of other West Africans who have made it this far finally can take a breath of relief and hope that the worst of their odyssey is over.

Hungary will never be Apetey's home; as everyone in the jaded asylum system knows, those seeking refugee status in Hungary do not stay to pursue the paperwork. This country is merely the most popular back door for tens of thousands of migrants annually who want to breach the perimeter of the European Union without obvious risk of death. Their long journey through the Balkans, often on foot and at night, has proved to be full of disappointment and danger, but not the mortal peril of a North African sea crossing to Italy — a journey that has produced more than a thousand dead in the southern Mediterranean this month alone.

For Apetey, "The stress is gone. I am in Europe!"

But not the right bit of Europe, not the part with large immigrant communities and work opportunities and greater freedom. By this time next week, he and most of the more than 2,000 migrants currently in Hungary's asylum shelters will be traveling to the wealthier west, their flea-bitten Hungarian beds taken by a new wave of Asians, Arabs and Africans.

___

To examine the peculiar situation in Hungary is to understand why the European Union is fighting a losing battle to control immigration. The 28-nation bloc is committed to human rights and free travel; it is far easier for Hungary to let the migrants head where they want to go, chiefly Germany and France, than to try to deport them by force in the other direction.

The country's three main asylum centers, funded in part by EU partners, include Soviet-era military barracks and are designed to hold perhaps 2,500 people — at current rates, less than 10 days' volume of human traffic.

While some facilities have coils of barbed wire atop the walls, the front doors are unlocked and residents can come and go as they please. Across the road from Hungary's biggest refugee camp in Debrecen, a strip of shops — including cash-wiring facilities, an Internet cafe and sellers of international telephone cards — provide the traveler key tools to move on.

"This system would immediately collapse if the asylum seekers decided to stay here rather than going towards western Europe within a few days," said Gabor Gyulai, refugee program coordinator for a Budapest-based human rights group called the Hungarian Helsinki Committee.

Gyulai estimates that at least 80 percent leave Hungary within one to 10 days of arrival. He notes that, last year, Hungary granted full refugee rights to barely 500 people, rejecting 90 percent of applications, highest in the EU. Hungary's right-wing leader, Viktor Orban, decries multiculturalism as a lie and proclaims a vision of deporting all skills-poor foreigners from Hungary someday.

The chief EU-wide refugee agreement dictates that migrants must claim asylum in the first member state they enter. Greece, however, has won an exemption because the European Court of Human Rights has ruled its asylum system an abusive shambles. The Greek anomaly means that migrants who make it across the Balkans from Greece to Hungary should, in theory, be sent back to Hungary when caught in other EU states.

This rarely happens, and as a result Hungary rapidly has become the third biggest entry point for illegal migration, behind Italy and Greece. More than 33,000 newcomers have passed through Hungary in the first three months of 2015 alone.

___

This is why The Associated Press has spent two months following a group of 45 West Africans as they attempt to navigate the so-called Balkans route from Turkey to Greece, Macedonia, Serbia and, finally, to Hungary.

They have surrendered thousands of euros (dollars) to traffickers for a journey that, in every nation and each link in the chain, has not gone as advertised. All have been pushed to the brink of exhaustion. Most have been robbed. Some have been raped or beaten.

And one — 31-year-old Sandrine Koffi from Ivory Coast — faced the prospect of losing her infant daughter, Kendra.

She and her then 10-month-old girl set out with the others in late February from northern Greece on foot. Their escort, a former soldier, charged most of them around $500 apiece to reach Macedonia's border with Serbia.

They hiked over hills and streams in rain and snow, mostly at night, but food and water ran low as they fell behind schedule amid injuries, freezing conditions and exhaustion. After 10 days Macedonian police chased them down, deporting most to Greece while others abandoned their belongings and scattered.

Amid that melee Koffi became separated from Kendra. Police dumped the mother back on the Greek side of the border, while escaping migrants carried the infant to Lojane, a Macedonian town bordering Serbia.

Desperate, Sandrine Koffi made two more attempts to cross through Macedonia on foot, evading police on the third try.

But when she reached Lojane three weeks after losing her girl, Kendra was gone — already carried by other migrants through Serbia to Hungary.

It took Koffi another week to cross Serbia and reach the Debrecen camp, where she found Kendra underweight from diarrhea and wailing with baby teeth coming in.

All the while on the grueling walk north, Koffi had worried: What if my girl has forgotten who I am?

"But the bond stayed strong," she said, holding her now 1-year-old Kendra on her lap on a bench outside the camp. "She remembered my scent."

Koffi is hoping to reach Paris where her husband and sister live. But her ordeal has taken its toll.

"I fought to come here because of my baby. I want her to have more chances in life," she said. "But otherwise it's not been worth it."

___

Lojane is a hub for Bangladeshi-led smugglers who specialize in trucking migrants surreptitiously through Serbia. They operate "safe houses" in abandoned industrial buildings outside town. In reality, if the migrants arrive with too little money, their safe house can become a prison and torture chamber.

Hamed Kouyate, an 18-year-old Ivorian who dreams of becoming a pro soccer player in Europe, said he was elated to escape the club-wielding police in Macedonia — only to experience far greater dangers in Lojane.

"Once you're there, you're trapped," Kouyate said. "You're in the hands of the mafia."

Kouyate said he was packed into a 4-meter-wide (13-foot-wide) room with about 50 people, who were forced practically to sleep on top of each other. With each passing day, the smugglers demanded more money to free them, billing them for rent and food. Men who lacked the cash were beaten; women were gang-raped.

He said some migrants had been stuck there for two weeks to a month in freezing, filthy conditions. But he still had hidden savings and bought an escape ticket after two days. First, he took a car with a dozen people piled inside, then a cattle truck with 32 people sharing space with four cows. Police intercepted that truck, the driver ran off, and he was deported back to Lojane, 550 euros ($600) poorer with no chance for a refund.

Kouyate finally reached Hungary a week later after covering much of Serbia on foot.

At the Hungarian border, he joined several migrants from Cameroon and Eritrea. They walked along a freezing stream, tripped a motion detection sensor, ran from German police who have been deployed to the frontier to boost the Hungarians' efforts, then shocked himself on an electric fence.

They abandoned rough ground in favor of road, even though that meant likely rapid detection. Within minutes, police approached. Kouyate didn't know which country he was in.

"Thank God it was the Hungarian police," he said. "We were thrilled, because when the Serbs stop you, they take your money, your cell phone, everything." The Hungarians warmed them up with blankets, put them in jail for a day, then bused them to a migrant camp near the Austrian border.

___

Apetey, the migrant in Budapest, also found himself stuck in the safe house but, unlike Kouyate, had barely any funds. Guards, he said, imprisoned him and beat him for 10 days. One friend had his arm broken by the guards, while "another got his head bashed in. Another got his teeth knocked out."

"I didn't have contacts to get me money, so I had to escape," he said. "Otherwise I was dead."

He lied to his captors, saying he had to walk into Lojane to telephone relatives for money. When the smugglers realized what he was really doing, two men armed with clubs barred his way. Apetey found out just how fast he could run in a pinch.

"I charged them, furious like a lion," he said, noting they couldn't keep up with him.

Apetey walked across the border into Serbia. There a gang posing as police officers confronted him, brandishing knives and demanding money. He stood his ground, and they picked on another group of migrants behind him.

Walking alone through Serbia, Apetey heard a passing motorist honk her horn. She was French, visiting friends in Serbia, staying at a hotel up the road — and she expressed admiration for Apetey's dreadlocks.

Within minutes, he was in in the woman's car, discussing whether she would drive him all the way to France. She thought this was a grand idea, but he didn't want a romantic entanglement.

He spent two days with the woman, who agreed to deliver him to the far side of the Hungarian border.

"We kissed," he said. "I needed to encourage her to drop me off."

___

Pogatchnik reported from London. Associated Press reporters Raphael Satter in London and Pablo Gorondi in Budapest contributed to this report.