Looking ahead to the presidential election next year, Lopez Obrador sought to tap widespread discontent with Mexico's ruling party and resentment toward the new U.S. president, while placing faith in Americans to resist Trump's policies.

"I think the wall and the demagoguery of patriotism are no match for the dignity and humanity of the American people," Lopez Obrador told the rally in Los Angeles.

"When they want to build a wall to segregate populations, or when the word 'foreigner' is used to insult, denigrate and discriminate against our fellow human beings, it goes against humanity, it goes against intelligence and against history," the veteran politician added.

A man wears a T-shirt with a picture of Mexican politician Andres Manuel Lopez Obrador, leader of the National Regeneration Movement (MORENA) party during a meeting at Plaza Olivera in Los Angeles, California, U.S., February 12, 2017.Ringo Chiu

His visit to Los Angeles came as thousands of people took to the streets in cities across Mexico to protest against Trump.

Slideshow (2 Images)

Three weeks into his administration, Trump has vowed to move ahead with construction of a wall on the border, repeatedly insisting that Mexico would pay for it, while also signalling a new push to deport millions of unauthorised immigrants out of the United States.

"If the Mexican government does not put before the United Nations in the coming days a complaint about the violation of human rights, then we will do it ourselves," Lopez Obrador said.

Mexican President Enrique Pena Nieto and Trump have been at loggerheads over the stance Trump first took against Mexico while campaigning for the U.S. presidency last year.