PANAMA CITY (Reuters) - Pope Francis said on Friday it was “senseless and irresponsible” to stigmatize migrants and see all of them as threats to society, weighing in again on one of the most divisive issues in the United States.

Francis, who has made migration a key theme of his trip to Panama, spoke to several hundred thousand young people at a religious service on the waterfront of the country’s capital, one of the key events of the Roman Catholic Church’s World Youth Day.

“We want to be a church that fosters a culture that welcomes, protects, promotes and integrates; that does not stigmatize, much less indulge in a senseless and irresponsible condemnation of every immigrant as a threat to society,” he said.

Hours earlier, President Donald Trump agreed under mounting pressure to end a 35-day-old partial U.S. government shutdown but without getting the $5.7 billion he had demanded from Congress for a wall along the U.S.-Mexico border.

At Friday night’s event known as a “Via Crucis” (Way of the Cross), Francis spoke of learning “how to welcome and take in all those abandoned, and forced to leave or lose their land, their roots, their families and their work.”

“How are we to react to Jesus as he suffers, travels, emigrates in the faces of many our friends, or of all those strangers that we have learned to make invisible?” Francis said.

It was the latest time the pope has waded into the standoff over funding for a U.S.-Mexico border wall. He told reporters on the plane from Rome on Wednesday that hostility to immigrants was driven by irrational fear.

Slideshow ( 13 images )

He and Trump have sparred before on migration, particularly on the border wall.

Since mid-October, thousands of Central Americans, mostly from Honduras, have traveled north to the United States through Mexico in caravans, some walking much of the way.

Many are seeking asylum, saying they suffer from rampant crime and bleak opportunities in their native countries.

On Friday morning, Francis visited a juvenile jail to comfort young people who could not leave to attend the global gathering of Catholic youth, and the pontiff urged society to give offenders everywhere a second chance.

“A society grows sick when it is unable to celebrate change in its sons and daughters,” he said at a prayer service with about 200 juvenile inmates in the town of Pacora, east of Panama City.

Francis, a strong supporter of rehabilitation of inmates and an opponent of life imprisonment, has visited many prisons in Italy and on his overseas trips.

He has called for a worldwide ban on the death penalty, and under his watch last year the Catholic Church formally changed its teaching to declare capital punishment inadmissible in any circumstance.

One out of every three criminals in Latin America are repeat offenders and the majority commit crimes that are more serious than those for which they were first jailed, according to a study by the Inter-American Development Bank.