President Barack Obama gestures as he answers a question during a news conference Friday with Costa Rica President Laura Chinchilla at the National Center for Art and Culture in San Jose, Costa Rica. Obama was responding to the ongoing situation in Syria. (ASSOCIATED PRESS / Pablo Martinez Monsivais)

SAN JOSE, Costa Rica (AP) — President Barack Obama came to Latin America eager to move the region’s relationship with the U.S. beyond fighting drugs and organized crime, yet the pervasive problems still trailed him throughout his three-day trip to Mexico and Costa Rica.

In the Costa Rican capital Friday, Obama defended his administration’s efforts to stem U.S. demand for drugs that many regional leaders see as a driving factor in their security issues. He said the U.S. and Latin America share “common effects and common responsibilities” for the troubles and argued that his country has suffered from the drug epidemic as well.

“There’s a cost obviously in the United States as well,” Obama said during a joint news conference with Costa Rican President Laura Chinchilla. “It’s not as if we don’t have tragic drug problems in the United States.”

The president singled out the violence that has raged in his hometown of Chicago, where the murder rate has soared, saying there are young people killed there “every day as part of the drug trade.”

Obama’s visit is his first to Latin America since winning a second term, in part due to the overwhelming support he received from Hispanic American voters. His trip is being followed with great interest by Hispanics in the U.S. as well as in Mexico, Central America and further to the south.

In both Mexico and Costa Rica, Obama cast economic growth as the best way to combat violence and keep drugs and organized crime from taking hold of another generation.

“We have to make sure that everybody feels opportunity,” the president declared in Costa Rica. “Even in countries that are doing well, the scourge of drugs and drug trafficking will still be there. And there still needs to be a strong law enforcement component. But we can do better than we are currently doing. “

The president had sounded a similar message earlier Friday in Mexico, which he touted as a nation ready to take “its rightful place in the world.” During a speech to students, he urged Mexico’s young people to help the region move beyond “old stereotypes” and highlighted developments in technology and manufacturing.

While many people in Central America are also weary of the focus on the drug-fueled violence, it remains an undeniable part of daily life in many parts of the region. Costa Rica has fared better than many of its neighbors, but it worries about spillover from nearby countries. Honduras, for example, now has the highest homicide rate in the world, with about 7,200 people murdered last year in the tiny nation of 8 million people, most in drug-related crime.

Obama acknowledged the role of U.S. demand for drugs and said his administration has spent $30 billion to reduce demand in recent years. But he acknowledged that the U.S. is a “big market” and that “progress is sometimes slower than we’d like it to be.”

The president arrived in the capital of San Jose on a rainy afternoon but received a warm welcome from thousands of Costa Ricans who lined the road near the airport. Some waved American flags. Others held homemade signs, including one that said “Fired Up!” — a reference to his campaign slogan — in a much more demonstrative welcome than he had received in Mexico.

After Obama met one-on-one Chinchilla, the first woman to head the Central American nation, the two leaders were serenaded by local schoolchildren waving U.S. and Costa Rican flags.

Later Friday, Obama met with leaders of the regional Central American Integration system, chaired by Chinchilla. The network also includes Belize, El Salvador, Guatemala, Honduras, Nicaragua and Panama. He’ll speak to business leaders in Costa Rica on Saturday before returning to Washington in the evening.

Obama has also been pressed throughout his trip about the immigration debate raging on Capitol Hill. The president is largely supportive of the bipartisan bill, which would strengthen borders and provide a pathway to citizenship for many of the 11 million people already in the U.S. illegally.

However, the draft legislation leaves out measures Obama has promoted on his own, including the recognition of gay and lesbian couples. Many Republicans are unlikely to support a bill that includes recognition of same-sex couples, raising the question of whether the president would fight for the provision if it meant losing out on a comprehensive bill.

Obama tried to sidestep the issue Friday, saying that while he believes the provision is “the right thing to do,” it was premature for him to talk about what he’ll do before he sees a bill on his desk.

However, Obama said earlier Friday in an interview with Spanish-language television network Univision that he would not sign a bill that does not include the pathway to citizenship.

Before traveling to Costa Rica, Obama wrapped up his two-day trip to Mexico, his fourth visit to the country since becoming president. He eagerly promoted Mexico’s improving economy and its democracy, saying “a new Mexico is emerging.”

“Mexico is also taking its rightful place in the world, on the world stage. Mexico is standing up for democracy not just here in Mexico but throughout the hemisphere,” Obama told a crowd of young people during a speech at Mexico City’s grand National Museum of Anthropology. “Mexico’s sharing expertise with neighbors across the Americas. When they face earthquakes or threats to their citizens or go to the polls to cast their votes, Mexico is there helping its neighbors.”

Despite Obama’s rosy portrayal, Mexico’s high poverty rates have barely budged in recent years. Its economy grew by only about a 1 percent rate in the first three months of 2013 and is not creating anywhere near the 1 million jobs annually it needs to employ young Mexicans entering the workforce.

The president has a domestic political incentive for trying to change America’s perception of Mexico. As Washington debates the immigration overhaul, Obama is seeking to convince the public and lawmakers that Mexico no longer poses the illegal immigration threat it once did.