If you want to come to the United States illegally, the worst point of entry is along the southern border. If the U.S. Border Patrol doesn’t get you, the gangs that prey on the hapless might; if not, you have a good chance of dying of heat prostration and lack of food and water in the desert.

The smart ones, the conniving illegals, aren’t the destitute walking in blazing heat for a rendezvous with Border Patrol agents and then lord knows what, but those who fly in with student visas, tourist visas and other travel documents and disappear into the shadows.

The people in what is loosely called a “caravan” now walking toward the border have been failed by the societies that bore them. They live in fear of murder, fear of repeated rape and other violence, and fear of starvation. They live in their own circle of hell.

But they aren’t alone. There are many millions more in the failed and failing states, war-ravaged and drought-plagued, in Africa and the Middle East, trying to find a new home. Their exodus is a trickle today but will be a torrent tomorrow and a flood later.

The hopeless are on the march and they threaten to engulf some nations, like tiny Malta, an island in the Mediterranean and a European Union member state.

Europe is struggling with a flood of desperate people who cross the Mediterranean from North Africa in overloaded rafts and boats, risking drowning to reach Malta, Greece or Italy: places where they hope for food, shelter and safety.

Illegal immigration is a global problem. No country has a solution and no country deals well with it.

There are wars and insurgencies in Africa and the Middle East: Consider just the Democratic Republic of the Congo and South Sudan.

Of Africa’s 54 countries, none has anything like enough jobs for its population — its  growing population. Even rich South Africa has a growing population and shrinking economic activity. Add to the failed or under-performing economies drought and climate change and you can imagine new surges in migration — surges so large they could overwhelm the target countries.

In the Middle East, new refugees are created daily. Eleven million are on the brink of famine in war-engulfed Yemen, and Syria continues to generate refugees at a stupendous rate.

Thirty-five years ago, I was at France’s Ministry for Europe and Foreign Affairs, known colloquially as the Quai d’Orsay. My briefer said, “If we don’t solve the problem of poverty, we’ll get three imports we don’t want: drugs, terrorism and people.”

The world hasn’t solved the poverty problem and it’s gotten the three things it doesn’t want.

There is no grand solution at hand, but there are small things that can be done. For us, the first might be to stop worsening conditions in the countries that are generating the flows of people toward the border. Two things would help: Don’t cut off foreign aid, exacerbating economic conditions, and don’t cut off the flow of expatriate earnings, which is so important in those countries. In other words, stop the deportations.

People who are here illegally and hold jobs would hold better jobs if their status was legalized. One solution would be time-limited work permits: not citizenship, work permits.

This is advocated by the Immigrant Tax Inquiry Group, which adds an appealing twist. The Malibu, Calif.-based group recommends that illegals should pay a special tax on their wages with an equivalent tax paid by the employer. The purpose of the tax is to alleviate the local effect of immigrants on schools, policing, courts and health care.

Considering the global problem, we have a small, manageable one. The caravan of people walking through Mexico have a bigger problem: They’re inflaming Americans and endangering their own lives — some deaths have been reported.

But if I were destitute and feared for my life in Central America, I’d likely be headed for the border, feeling I was doing something, even something hopeless.