Pope Francis visits Mexico jail on last day of tour
Pope Francis has visited a prison in the northern city of Ciudad Juarez on the last day of his five-day visit to Mexico.
He is now celebrating an open-air mass on the US border in front of hundreds of thousands of people.
The Pope is expected to use the ceremony to highlight the suffering of migrants, tens of thousands of whom cross the border every year.
Ciudad Juarez was once one of the most violent cities in Mexico.
Pope Francis visited the Cereso jail, a mixed prison in Ciudad Juarez which houses about 700 inmates, 250 of them women.
His visit was seen as a chance to give hope to the city's residents, who lived through a spate of murders of women and rampant drug violence which meant few dared leave their homes at night.
"The problem of security is not resolved only by incarcerating; rather, it calls us to intervene by confronting the structural and cultural causes of insecurity that impact the entire social framework," the pope told the inmates.
The pontiff's visit came just days after 49 prisoners died in a fight between rival gang members at the Topo Chico jail in the north-eastern city of Monterrey.
Mexican prisons are notoriously overcrowded and corrupt and the meeting between inmates and the pontiff is expected to draw further attentions to these problems.
Later on Wednesday, the Pope will hold a mass at a huge stage set up by the Rio Grande river that separates the Mexican state of Chihuahua from Texas, in the US.
He is expected to kneel down next to a pair of worn sandals, a symbol for the thousands of migrants who have died trying to cross into the US.
The mass will be broadcast on a giant screen in a football stadium in El Paso, Texas.
The Pope's message comes as immigration has become one of the main issues on the US presidential campaign.
'Dare to dream'
The BBC's Mexico correspondent Katy Watson says Pope Francis's entire tour in Mexico has been focused on speaking to people who are marginalised.
He has repeatedly called on the country's leaders to make it a better place for people to live.
On Tuesday, he told young Mexicans in the violence-hit state of Michoacan "to dare to dream".
He urged them to reject a life of crime and to "feel your value".
"It is a lie to believe that the only way to live, or to be young, is to entrust oneself to drug dealers or others who do nothing but sow destruction and death.
"Jesus would never ask us to be assassins; rather, he calls us to be disciples," the pontiff said.