Updated

President Barack Obama said Thursday theishifting security relationship with Mexico in the cross-border fight against drug trafficking and organized crime would not hurt cooperation between both countries.

But being careful not to intrude on the southern neighbor's sovereignty, Obama noted that Mexicans have the right to determine how best to tackle the violence that has plagued their country. He spoke during a press conference Thursday with Mexican President Enrique Peña Nieto.

Since taking office in December, Peña Nieto has moved to end the widespread access that U.S. security agencies have had in Mexico to tackle the violence that affects both sides of the border. It's a departure from the strategy employed by his predecessor, Felipe Calderon, which was praised by the U.S. but reviled by many Mexicans.

"I agreed to continue our close cooperation on security, even as the nature of that cooperation will evolve," Obama said during a joint news conference at Mexico's grand National Palace. "It is obviously up to the Mexican people to determine their security structures and how it engages with the other nations — including the United States."

"I suspect that the final legislation will not contain everything I want. It won't contain everything that Republican leaders want, either."

— President Barack Obama

Peña Nieto also downplayed the notion that the new, more centralized arrangement would damage its security partnership with the United States. He said Obama agreed during their private meeting earlier in the day to "cooperate on the basis of mutual respect" to promote an efficient and effective strategy.

Obama arrived in Mexico Thursday afternoon for a three-day trip that includes a stop in Costa Rica on Friday. Domestic issues followed the president south of the border, with Obama facing questions in his exchange with reporters about the potential escalation of the U.S. role in Syria, a controversy over contraception access for teenage girls, and the delicate debate on Capitol Hill on an immigration overhaul.

The latter issue is being closely watched in Mexico, given the large number of Mexicans who have emigrated to the U.S. both legally and illegally. More than half of the 11 million people in the U.S. illegally are Mexican, according to the Pew Research Center.

For Obama, the immigration debate is rife with potential political pitfalls. While he views an overhaul of the nation's patchwork immigration laws as a legacy-building issue, he's been forced to keep a low-profile role in the debate to avoid scaring off wary Republicans.

In an effort to court those GOP lawmakers, the draft bill being debated on Capitol Hill focuses heavily on securing the border with Mexico, and makes doing so a pre-condition for a pathway to citizenship for those in the U.S. illegally. But Florida Republican Sen. Marco Rubio, one of the bill's architects, said Thursday that unless the border security measures are made even tougher, the legislation will face tough odds not only in the GOP-controlled House but also in the Democratic-led Senate.

The president acknowledged there were some areas along the 2,000-mile border between the U.S. and Mexico where security needs to be tightened. But he gently chided Rubio and other Republicans for putting up obstacles that would derail final legislation.

"I suspect that the final legislation will not contain everything I want. It won't contain everything that Republican leaders want, either," Obama said. He added that "what I'm not going to do is to go along with something where we're looking for an excuse not to do it as opposed to a way to do it."

Despite the intense interest in the immigration debate among Mexicans, Peña Nieto carefully avoided injecting himself in the issue. While he commended the U.S. for tackling the challenge, he said the congressional debate "is a domestic affair."

The new Mexican leader was purposely seeking to avoid the perceived missteps of former Mexican President Vicente Fox, who irked conservatives in the U.S. by lobbying for an immigration overhaul in 2001.

Peña Nieto's election brought Mexico's Institutional Revolutionary Party, or PRI, back to power after a decade on the sidelines. The security changes are emblematic of the party's preference for centralized political and bureaucratic control.

The arrangement means all contact for U.S. law enforcement will now go through a "single door," according to Mexico's federal Interior Ministry, the agency that controls security and domestic policy. Under the previous policy, FBI, CIA, DEA and Homeland Security had direct access to units of Mexico's Federal Police, army and navy.

U.S. agents worked side by side with those Mexican units in the fight against drug cartels, including the U.S.-backed strategy of killing or arresting top kingpins.

Obama lauded his Mexican counterpart for launching bold reforms during his first months in office, not only on security but also the economy. Both leaders have said they want to refocus the U.S.-Mexico relationship on trade and the economy, not the drug wars and immigration issues that have dominated the partnership in recent years.

In a nod to that effort, Obama and Peña Nieto announced a new partnership for closer cooperation between top officials in both countries. Vice President Joe Biden will also participate in that process, Obama said.

Already the economic relationship between the two countries is robust, with Mexico accounting for $500 billion in U.S. trade in 2011 and ranking as the second-largest export market for U.S. goods. A stronger Mexican economy would result in even more trade and job growth on both sides of the border, Obama aides say.

FRIDAY SPEECH, COSTA RICA VISIT

Obama was to deliver a speech Friday to an audience made up primarily of students, highlighting the role they can play in deciding Mexico's future and promoting the type of broad exchanges he envisions under a new immigration regime in the United States. After his speech, Obama was to meet privately with Mexican businessmen, where he would stress the commercial ties between the two countries.

Mexico is the second-largest export market for U.S. goods and services.

Later, he was to travel to Costa Rica, where he planned to deliver a blunter message to Central American leaders struggling with weak economies and drug violence.

Obama was to meet with Costa Rican President Laura Chinchilla, then attend a gathering of leaders from the Central American Integration system. The regional network also includes the leaders of Belize, El Salvador, Guatemala, Honduras, Nicaragua and Panama.

The U.S. view of the region is that its pervasive violence and security weaknesses are holding back economic growth, and that with fewer Mexicans crossing the border illegally, the rest of the region has become the main source of illegal immigration into the United States.

As a result, Obama is expected to call for stepped up security cooperation, regional economic integration, and improvements in human rights and democratic reforms.

Friday's Mexico City speech comes as Obama's popularity in Mexico has risen over recent years and as views of the United States also improve. A Pew Research Center poll in March found that two-thirds of Mexicans have a favorable opinion of the U.S., compared with 44 percent favorability in 2010. About half of Mexicans have confidence that Obama will do the right thing on world affairs, up from 38 percent in 2011.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino