MEXICO CITY — Mexico's turbulent relationship with the U.S. government under President Donald Trump dominated the country's second presidential debate Sunday.

The debate in the border city of Tijuana focused on issues of foreign policy, immigration and border security. The relationship with the U.S. came up repeatedly in questions from the moderators and from Tijuana citizens in the audience. All of the candidates insisted the relationship must be based on mutual respect.

They were asked about Mexicans taken to the U.S. as children by their parents who years later face the possibility of deportation, about reintegrating Mexicans deported from the U.S. and about whether Mexico should seal its southern border at the behest of the U.S. to block Central Americans from migrating north.

Polls indicate leftist candidate Andres Manuel Lopez Obrador has a comfortable lead over the remaining three candidates. Many have questioned about how confrontational he would be as president with Trump, but his answers about the U.S.-Mexico relationship Sunday were often the most moderate.

"I want a relationship of friendship, but not of subordination," Lopez Obrador said.

Jose Antonio Meade, former foreign minister and candidate for the ruling Institutional Revolutionary Party, defended President Enrique Pena Nieto's decision to invite Trump to Mexico during the U.S. presidential campaign in 2016. Trump and Democratic candidate Hillary Clinton were both invited, but only Trump accepted. Meade also said that he never thought Trump was going to win.

Ricardo Anaya, the candidate of a right-left coalition, called that episode a "humiliation" for Mexico and held up a large photograph of Pena Nieto and Trump shaking hands. He said Mexico should be more assertive with the U.S. "In security they need us a lot," Anaya said.

Independent candidate Jaime "El Bronco" Rodriguez said Mexico needs to wean itself from the U.S. "and put them in their place."

Another independent, Margarita Zavala, dropped out of the race earlier after struggling to gain traction. She is a former lawmaker and is married to former President Felipe Calderon.

The candidates agreed that Mexico should be welcoming to migrants fleeing violence and poverty in Honduras, El Salvador and Guatemala.

Lopez Obrador said Mexico should not do the United States' "dirty work" by blocking migrants from those countries. A caravan of Central American migrants drew the ire of Trump during its slow trip across Mexico.

Meade had a more balanced answer suggesting that Mexico had to distinguish between refugees and migrants tied to organized crime.

Anaya, who polls have placed in the second position, spent much of the evening attacking front runner Lopez Obrador and walking across the stage to stand in front of him as he did. Lopez Obrador called Anaya names and Anaya repeatedly framed Lopez Obrador, the race's oldest candidate, as out of touch.

One area of agreement between the candidates and Trump was the need to raise Mexican wages.

Tijuana resident Diego Dominguez Sanchez told the candidates he had lived in the U.S. for 13 years and returned to Mexico three years ago. Now he was working many more hours for less than half the salary.

Lopez Obrador said he agreed with Trump that Mexican wages must rise. Anaya said he would increase the country's minimum wage.

The national election is scheduled for July 1.