Defense Secretary Jim Mattis meets with U.S. Ambassador to Mexico Roberta S. Jacobson and Mexican military officers upon arriving in Mexico City on Friday. (Dan Lamothe/ The Washington Post)

MEXICO CITY — Defense Secretary Jim Mattis on Friday highlighted Mexico’s efforts to stop illegal drugs and human trafficking, saying officials here are “keenly aware” of their security challenges and working with the United States to confront them.

Mattis made his comments as he flew to Mexico to join celebrations of the country’s Independence Day and meet senior Mexican officials, including Foreign Secretary Luis Videgaray.

The visit coincides with the continuing debate over President Trump’s plan to build a border wall, which is deeply unpopular in Mexico. Mattis said he wanted to “pay our respects to our southern neighbor.” The United States and Mexico have very supportive military-to-military ties, and his visit is an effort to reinforce that, he said.

“I’m going down to build the trust and show the respect on their Independence Day,” he said.

The visit marks the latest occasion in which the defense secretary is attempting to reassure a U.S. partner hostile to positions taken by the Trump administration. The defense secretary, however, has expressed frustration when he has been portrayed as at odds with the president on policy, and instead has sought to highlight the strong relationships the U.S. military has with its counterparts across the world.

Mattis planned to meet Friday with senior Mexican military officials, including Gen. Salvador Cienfuegos Zepeda, Mexico’s secretary of national defense, and Adm. Vidal Francisco Soberon Sanz, the secretary of Mexico’s navy. They were joined by U.S. Air Force Gen. Lori Robinson, the chief of Northern Command, and the top U.S. Navy officer, Adm. John Richardson.

Mattis is the fifth U.S. defense secretary to visit Mexico and the first to do so for Independence Day festivities, defense officials said.

Mattis arrived in Mexico just after the New York Times reported that White House Chief of Staff John F. Kelly — in a meeting between Trump and congressional leaders — had compared Mexico to Venezuela during the tumultuous rule of Hugo Chávez and suggested Mexico was on the verge of a collapse.

Asked about the report, Mattis seemed to question such a dire characterization of Mexico.

“Every nation has its challenges,” he said of Mexico. “I’m here to support them in dealing with them.”

The defense secretary said there is no role for the U.S. military in defending the U.S.-Mexican border, adding that it will continue to be protected by U.S. Customs and Border Protection.

“Our job is overseas,” Mattis said of the military. “We have no arrest authorities.”

The U.S. military also has no role in stopping drug interdiction inside Mexico’s territorial waters, he said. In open ocean, the Pentagon works with the Colombian, Mexican and Costa Rican navies, he said.

Mattis’s visit marks the third stop in a trip in which he met with U.S. troops overseeing the nation’s nuclear weapons mission at Minot Air Force Base in North Dakota and Offutt Air Force Base in Nebraska. He was at the headquarters of U.S. Strategic Command, which oversees the U.S. nuclear mission, when North Korea launched its latest missile test Thursday evening, sending a ballistic missile over northern Japan and into the Pacific Ocean.

The defense secretary said the latest missile launch will further isolate North Korea.