HOUSTON — As President Trump moves to recast trade and border relations with Mexico, American oil companies are worried that the prospective winner of Mexico’s presidential election will play his own nationalist card.

The leading candidate, Andrés Manuel López Obrador, wants to reverse policies that have tied a knot between Mexico and the United States in recent years in energy production and consumption. And he has promised to make sure that oil never falls “back into the hands of foreigners.”

In addition to threatening refinery profits in the United States, his proposals could slow oil production in Texas and impede deepwater drilling in the Gulf of Mexico by international oil giants like Exxon Mobil and Chevron. They would also jeopardize the United States’ energy trade surplus with Mexico, which reached roughly $15 billion last year.

Mr. López Obrador, a former mayor of Mexico City with leftist leanings, has a comfortable lead in the polls ahead of the July 1 vote. He has moderated his tone since losing the presidential race six years ago, but he has proposed a sweeping reorientation of the nation’s energy policy with an emphasis on independence from the United States.