By Sharon Bernstein

SACRAMENTO Calif. (Reuters) - Mexican President Enrique Pena Nieto thanked California on Thursday for improving the lives of immigrants from his country, including legalizing drivers' licenses for undocumented migrants and making it easier for them to work and start businesses.

Pena Nieto, on his first trip to the United States since becoming president in 2012, addressed a joint session of the California legislature, detailing economic and electoral reforms enacted back home and emphasizing his country's social and economic ties to the state.

"I want to thank you for what you have done for migrants, especially the ones from Mexico," Pena Nieto said. "It's no coincidence that my first visit to the United States is in California."

Pena Nieto's visit was the latest in a series of exchanges with Mexico that included a trip to that country last month by California Governor Jerry Brown, a Democrat, and a visit to Sacramento by Mexico's foreign minister, Jose Antonio Meade.

The visits, part of an ongoing effort to further economic ties between California and Mexico, are taking place against a backdrop of growing tensions from the flow of thousands of undocumented children from El Salvador, Guatemala and Honduras into the United States from Mexico.

For their part, the Mexican leaders have expressed concern that efforts to enact comprehensive immigration reform have stalled in the U.S., amid opposition from Republicans in Congress.

On Thursday, several Republican state lawmakers who had been invited to a luncheon with Pena Nieto declined to attend, citing the ongoing detention of U.S. Marine Sergeant Andrew Tahmooressi, who was arrested on March 31 by Mexican customs agents who found guns in his pickup truck at the San Ysidro border crossing between San Diego and Tijuana.

A group of protesters demonstrated against Tahmooressi's detention across the street from Sacramento's Leland Stanford Mansion, where the luncheon was being held.

Story continues

Tahmooressi maintains he accidentally crossed the border, and had no intention of transporting weapons across an international border. He is being held in a federal penitentiary in Mexico.

“I could not go to the lunch in good conscience,” said state Senator Joel Anderson, a Republican whose district includes parts of Riverside County east of Los Angeles. “I don’t have an appetite for foreign dignitaries who deny U.S. citizens their human rights.”

Pena Nieto did not discuss the issue of the migrant children or the Tahmooressi case.

(Additional reporting by Joaquin Palomino in San Francisco; Editing by Eric Walsh)