The U.S. president is interested in a plan to open Mexico's energy industry and Enrique Peña Nieto is watching the immigration debate up north, but both want to avoid the appearance of interference.

WASHINGTON — President Obama will seek to cement relations with Mexico's new president, Enrique Peña Nieto, over the next two days with vows of neighborly kinship and future cooperation. But the true test of their ability to work together may be whether they can hold their tongues.

Obama's visit to Mexico City comes as the fight over border security and immigration reform has begun to consume Congress. Peña Nieto supports the effort but wants to avoid the mistakes of a predecessor, Vicente Fox, who lobbied for a 2001 immigration reform bill in Congress. Conservatives charged that Fox was meddling in U.S. affairs.

Obama will try to avoid the same charge. The White House is monitoring Peña Nieto's calls to reform Mexico's vast energy industry. U.S. companies could benefit if it opens oil and gas exploration to foreign investors. But a public endorsement by Obama, or even a perception of one, could undermine the already fraught endeavor.

"Mexicans have an understanding of noninterference. So they do not want us to talk about energy, and they will not talk about immigration," said Diana Negroponte, a senior fellow with the Latin America Initiative at the Brookings Institution. "It's a quid pro quo."

If those issues are raised at length publicly, she said, it may signal a "degree of irritation" in private talks.

The two leaders are likely to discuss their priorities and try to exert influence at a meeting and a dinner, both closed to journalists. Mexicans are concerned about the temporary work permits in the Senate bill on immigration, a detail that affects the flow of workers back and forth across the border.

Obama's aides have billed his visit as a chance to shift the U.S. perception of Latin America from drug wars and illegal border crossings to a region on the rise. This argument leans heavily on the success of Peña Nieto's reform agenda, which includes changes in education, telecommunications, banking and energy.

"What I'd say broadly is that energy is an area of great promise and cooperation across the Americas," Ben Rhodes, deputy national security advisor, said Wednesday.

Still, White House officials say they've put the word out that cooperation by Mexico is welcome, but commentary less so, especially on immigration. "We've emphasized on our side that this is a domestic political issue, primarily," said Ricardo Zuniga, senior director for Western Hemisphere affairs on the National Security Council.

"I think Peña Nieto has to be very careful," said Carl Meacham, a director of the Americas Program at the nonpartisan Center for Strategic and International Studies. "There are elements here who would view what he says as being partial to one side or the other. That is not helpful."

Mexico's interest is clear. About 60% of the estimated 11 million people who entered the U.S. illegally or overstayed their visas were born in Mexico, according the Pew Hispanic Center. Any law that puts them on a path to U.S. citizenship, sets limits on immigration or tightens border security will affect the Mexican economy.

So Peña Nieto is watching the U.S. debate, and his language, closely. Last month, Mexico's Foreign Ministry called the bipartisan bill in the Senate "a positive step" and urged that "the contributions of immigrants be considered and their rights safeguarded" as the process continued.

The approach is measured compared with Fox's lobbying of George W. Bush about a decade ago. Fox pressed Bush to increase the number of green cards and visas for foreign workers. His foreign minister, Jorge Castañeda, said Fox wanted the "whole enchilada." The phrase irked U.S. conservatives and probably did more harm than good to the doomed bill.

Obama, in turn, must be mindful of how he discusses Peña Nieto's agenda, especially his call to open oil and gas exploration to private and foreign companies. It's sensitive, in part because the government-owned oil monopoly, Pemex, is part of the national identity.

Pemex controls all Mexican oil and gas production, distribution and exportation, and it is the nation's top source of revenue. But production has been declining rapidly for a decade or more. Also, drug traffickers and other criminal gangs have stolen large quantities of oil and gas and kidnapped Pemex workers in the states of Tamaulipas, Veracruz and Tabasco, where most oil fields are located.

All of this argues for foreign capital, technology and equipment, especially for deep-sea exploration. But the government will meet fierce resistance from Pemex's labor unions, long a pillar of support for Peña Nieto's Institutional Revolutionary Party, or PRI, as well as from the political left and old-guard nationalists.

"It's one thing to enact an oil statute, but quite a different matter to control the violent demonstrations that rabble-rousers … will endeavor to incite," said George W. Grayson, a Mexico expert at the College of William & Mary in Virginia.

The PRI nationalized the oil industry in the 1930s after decades of what many saw as exploitation by foreign oil companies. Today, most Mexicans consider public ownership of the country's most lucrative natural resource a cornerstone of sovereignty and national pride.

Peña Nieto has made it clear that ownership of Pemex will remain in government hands even if foreign investment is allowed. His plan does not include privatization, the president has said.

Some analysts have suggested that Mexico's recent agreement to export an additional 30,000 barrels of crude oil a day to China is a way to show doubters that opening up Pemex is not just for the benefit of U.S. companies.