Aztec emperor Montezuma believed that Conquistador Hernan Cortes was the incarnation of the god-ruler Quetzalcoatl.
This deity was usually depicted as a feathered serpent, but a prophecy had said that he would come in the form of a light-skinned, bearded man, and Cortes fit that description. Seeing no point in resisting a god, Montezuma showered Cortes with gifts.
Cortes thanked him by taking him prisoner, and tried briefly to rule through him.
The Aztec people rose against Montezuma and the Spanish in 1520. The emperor died in the fighting. Cortes was forced to retreat from Tenochtitlan, but came back with a vengeance the following year. He captured the capital and defeated the empire.
The marines sing “From the halls of Montezuma…” because they occupied the “halls,” or palace, of the Aztec emperor in 1847, when the United States conquered Mexico City in the Mexican War.