Still, up to 60,000 people are trapped at the Syria-Jordan border. After Jordanian security officials were killed by an Islamic State car bomb in 2016, the government closed down access to another camp, Rukban, and banned border entry to Syrians. That has left Syrians camping in the desert in a no man’s land, an area called “the berm.” There, thousands are vulnerable to airstrikes, living in desperate conditions and subsisting on scarce rations. Disease is rife, but the Jordanian authorities have blocked access to aid and medical treatment, designating the area a closed military zone.

Amid this suffocating humanitarian crisis, the Trump administration has threatened to cut funding to international aid agencies that are assisting Syrian refugees. As the United States slouches away from its global leadership role, regional powers like Turkey are stepping in to fill the vacuum. Turkey and its 80 million people have welcomed more than three million Syrian refugees.

“Syrian refugees are not a problem to solve,” the head of the Turkish emergency relief effort told me. “They are a reality to manage.”

The Turkish city of Gaziantep sets an example in treating refugees humanely. A beautiful city on the Syrian-Turkish border, Gaziantep is said to house 600,000 Syrians, approximately 40,000 of which live in the city’s five camps, which are administered by Turkey’s Disaster and Emergency Management Presidency. The rest — the vast majority of them — live in the city itself. Refugees are allowed to work and have access to free health care and schools, and the government has repeatedly committed to creating a pathway to Turkish citizenship.

Gaziantep’s mayor since 2014, Fatma Sahin, has made the safeguarding of refugee rights a signature policy. Her city has become a global model on how to embrace the survivors of a war. I accompanied Ms. Sahin to see some makeshift homes in the city’s camps, where the Syrian refugees greeted us as though we were long-lost relatives. It was inspiring to see hope alive for an otherwise humiliated people.

Turkey’s refugee policy does not stop at its border. I visited Jarabulus in Syria, a town liberated from Islamic State control last year by the Turkish military. While Ankara’s motives are many, one concrete result is a reduction in the flow of refugees across the border and the possibility that many refugees can return to their homes. In place of the Islamic State’s summary justice and public beheadings, there is now a hospital with a maternity ward. The schools are being rebuilt, and the city has formed a new local council.

Though facing difficulties of its own — the attempted military coup was little more than a year ago — Turkey has managed to pursue a far more humane refugee policy than its neighbors. Europe has been happy to let Turkey play this leading role in refugee relief. President Recep Tayyip Erdogan’s government struck a deal with the European Union in which Europe is funding Turkey’s refugee program in exchange for preventing migrants from reaching European shores.