US President Barack Obama has admitted that guns from his country are partly to blame for deadly violence in Mexico, as he pledged to forge an equal partnership between the two neighbours as they battle powerful drug cartels.
Obama also said he sees a "new Mexico" emerging, with a deepening democracy and growing economy, as he addressed an audience dominated by students on Friday.
The president was visiting Mexico to discuss drug policy and immigration, among other things, with Mexican President Enrique Pena Nieto.
Obama conceded that the root of much violence in Mexico is the demand for drugs in the US, and acknowledged that most guns used to commit crime in Mexico come from across the border.
He also said a rising economy is changing Mexico and improving its middle class.
"It's time to recognise new realities including the impressive progress in today's Mexico," he said.
"I see it in the deepening of Mexico's democracy, citizens who are standing up and saying that violence and impunity is not acceptable.
"In this relationship there is no senior partner or junior partner. We are two equal partners, two sovereign nations that must work together in mutual interest and mutual respect."
Improving trade relations
Obama said he is optimistic that the US will change its patchwork of immigration laws.
With about 6 million Mexicans illegally in the US, the issue resonates deeply in Mexico, which also has seen deportations of its citizens rise dramatically under Obama's time in office.
Underlying Obama's visit is his desire to persuade the US public and politicians that Mexico no longer poses the illegal immigration threat it once did.
"The long-term solution to the challenge of illegal immigration is a growing and prosperous Mexico that creates more jobs and opportunities for young people here,'' Obama said.
To that end, he called for improving the growing trade relationship between the two countries.
While the Mexican economy is growing, some of that growth is due to the fact that wages largely have stagnated, while China's have risen, making Mexico more of a low-wage paradise.
Mexico's economy grew by about 1 percent in the first three months of the year and the country is not creating the million jobs annually it needs to employ all the young people entering its workforce.
Obama was due to meet other Central American leaders in Costa Rica on Friday to discuss violence in the region and the American perception that, with fewer Mexicans crossing the border illegally, the rest of the region has become the main source of illegal immigration into the US.