Mexico apologized for disrupting the military funeral of a U.S. Marine killed in Iraq, but insisted that it had to make sure its laws outlawing foreign troops from carrying weapons on Mexican soil were upheld.

U.S. Ambassador Tony Garza (search) had sent a blistering diplomatic note Tuesday demanding to know why Mexican troops interrupted the funeral Sunday for Lance Cpl. Juan Lopez (search), who had migrated to the United States from Mexico and was killed west of Baghdad on June 21.

The Mexican soldiers took issue with non-working, ceremonial rifles carried by two Marines who traveled from the United States for the ceremony, but Garza said the Marines had worked everything out beforehand.

"This should have been an opportunity not only to honor a hero, but also for Mexico to honor one of its own sons," Garza said in the letter.

Mexico's Foreign Relations Secretary responded to Garza's note late Tuesday by saying it was "sorry the actions that occurred during the ceremony caused the interruption of such a solemn act, especially for Mr. Lopez's family members, his Marine compatriots and U.S. diplomats present at the act."

But, the secretary said, Mexico's soldiers "had an obligation" to ensure the law wasn't being violated.

"The intervention of the members of the Mexican army was for the sole purpose of verifying the [kind of] weapons the honor guard was carrying during the ceremony," it said.

Marines had originally planned to conduct a traditional 21-gun salute during the funeral in San Luis de la Paz, Lopez's hometown. But Mexico's Secretary of Defense turned down the request, saying the salute violated constitutional measures preventing foreign soldiers from bearing arms on Mexican soil.

Even so, problems at the funeral began when four U.S. Marines marched to the burial plot hoisting an American flag and the colors of the Marine Corps. Two of the men carried rifles that looked real, but could not be fired.

Four Mexican soldiers blocked their path, asking the four Marines and six others who had served as pallbearers to return to a Chevrolet Suburban that had brought them to the funeral.

Several minutes of discussions continued until taps began and the funeral continued over the objections of the Mexican troops.

When the ceremony was complete, all the Marines on-hand returned to a U.S. Embassy vehicle, and waited while 14 Mexican soldiers arrived to guard the premises. About 40 minutes later the van was allowed to leave.

Surprised by the interruption, members of Lopez's family said they planned to ask Mexican officials for a full explanation of what occurred.

In his statement earlier Tuesday, Garza was more pointed.

"The interruption of the ceremony was an affront to the dignity of the family in their grief over the sacrifice of a Mexican citizen, and they deserve an apology from those who caused this hurtful incident," the ambassador said.

Mexico has a deep suspicion of foreign military forces in its territory. The Marine Hymn's "Halls of Montezuma" refers to the 1847 U.S. capture of Mexico City.

Lopez migrated as a teenager to Dalton, Ga. to be with his father, three brothers and a sister. Once there, he met his wife, Sandra Torres, and married her in San Luis de la Paz in December.