CIUDAD JUAREZ, Mexico - Pope Francis wrapped up a five-day visit to Mexico with a message of love and compassion for the people of Mexico and the migrants who pass through it on their way to the United States. For their political and religious leaders, the trip was more a lesson in tough love.

The pontiff used his time here to criticize Mexico's ruling class for failing to protect people from predatory criminal gangs and rampant corruption, and he lectured bishops to get closer to their flock and ease their suffering. He also visited some of the country's poorest and most violent areas to shine a spotlight on residents' harsh reality.

The final day on Wednesday was the most symbolic and politically bold moment of Francis' trip, with hundreds of thousands gathering for Mass at a Ciudad Juarez fairground while an estimated 30,000 more watched via simulcast at a football stadium across the Rio Grande in El Paso, Texas.

Francis also aimed a message north of the border at a time of increasingly tough presidential campaign rhetoric on immigration in the United States.

The pope appealed for governments to open their hearts to the "human tragedy" of forced migration. "No more death! No more exploitation!" he implored.

Francis stopped short of calling outright for the U.S. to open its borders, but he urged recognition that the multitudes fleeing gangland killings and extortion in their homelands are victims.

"We cannot deny the humanitarian crisis which in recent years has meant the migration of thousands of people, whether by train or highway or on foot, crossing hundreds of kilometres through mountains, deserts and inhospitable zones," he said. "They are our brothers and sisters, who are being expelled by poverty and violence, drug trafficking and organized crime."

"It's a message directed at everyone, from the authorities to ourselves," said Natalia Herrera Miranda, a Juarez resident who was at the Mass. "And Americans as well, so that they take immigrants in and see them for what they are - people just like everyone else."

Before the Mass, Francis paused at the border for a silent prayer in memory of migrants who died trying to reach the United States. He also blessed several hundred migrants sitting on the other side of the fence.

Angelica Ortiz, one of those invited to be on the U.S. side, said she left Ciudad Juarez because drug traffickers threatened her son's life and now lives in El Paso after being granted asylum.

"I'm overcome by emotion," Ortiz said afterward, practically speechless. "A lot of emotion."

It was the most poignant moment of Francis' trip, but he began to turn heads even before his plane touched down in Mexico.

Flying in from the Vatican on Friday he first landed in Havana for a historic meeting and embrace with Patriarch Kirill of the Russian Orthodox Church, the first such encounter since the schism that divided Christianity a millennium ago.

Once in Mexico, Francis appeared to go beyond the normally gentle criticism that popes make on foreign trips, holding the feet of Mexico's powerful to the fire again and again.

On his first full day in the country, Francis told President Enrique Pena Nieto and other members of the government in a speech at the National Palace that public officials must be honest and not be seduced by privilege and corruption.

He followed that up with a pointed address to his own bishops in which he admonished them to be true pastors, not career-minded clerics who spew inoffensive denunciations like so many "babbling orphans beside a tomb."

"We do not need 'princes,' but rather a community of the Lord's witnesses," Francis said.

Moving on to the hardscrabble Mexico City suburb of Ecatepec, Francis condemned drug traffickers as "dealers of death" and urged Mexicans to shun the temptation of money, saying, "With the devil, there is no dialogue." He repeated a similar message two days later in the violence-torn state of Michoacan, telling young people that Jesus "would never ask us to be hit men."

In the poor state of Chiapas in southern Mexico, Francis denounced centuries of exploitation and exclusion of indigenous Mexicans. He also prayed before the tomb of a priest who had made it his mission to protect the indigenous, often irking the church hierarchy in the process.

Observers said the pontiff's actions, words and choice of events showed he feels both the Mexican church and the government have failed the country's poorest and most vulnerable.

"The pope literally believes that the devil is on the loose in Mexico, sowing death, misery and resignation, and he believes that the state, the church and the drug dealers are complicit," said Andrew Chesnut, chairman of Catholic studies at Virginia Commonwealth University. "He believes that Mexico, with the second-largest Catholic population in the world, is going through an acute moral and political crisis and that the church needs to become an active agent to build a more just Mexico."

-----

Associated Press writer Christopher Sherman reported this story in Ciudad Juarez and Peter Orsi reported from Mexico City. AP writers Nicole Winfield in Ciudad Juarez, E. Eduardo Castillo in Mexico City and Astrid Galvan in El Paso, Texas, contributed to this report.