MEXICO CITY — After weighing the risks of traveling to Mexico, the parents of one American teenager decided to allow her to join a school trip to Oaxaca, where students volunteered at an orphanage, visited archaeological sites and sipped vanilla milkshakes on the honey-colored town plaza.

The fact that the parents were President Obama and the first lady, Michelle Obama, and that the teenager was their daughter Malia, thrilled Mexican tourism officials, who are trying to redefine the country’s image as it has struggled with drug violence.

“It’s a compliment that the daughter of President Obama and her friends have decided to live the experience of Oaxaca,” said José Zorrilla, the state secretary for tourism and economic development, slipping into promotion mode.

Each updated travel advisory from the United States State Department is painted as an affront here. Especially galling to Mexicans was the spring break warning issued by the Texas Department of Public Safety suggesting that Texans avoid Mexico altogether.