Montezuma (Monteczuma) refers to Mexico, and the Mexican-American War (1846-1848) while the "shores of Tripoli" refers to the naval wars against the Barbary pirates (1801-1805 and again in 1815).
Montezuma or MocTezuma was the 5th Aztec emperor. His father was the 2nd Aztec king. He was born in 1398 and died in 1469.His first name, pronounced [moteːkʷˈsoːma] in Classical Nahuatl, means "he frowns like a lord". Montezuma was a ruler of the Aztec. The conquistadors Hernando Cortes captured Montezuma for about 2 months. The Aztec people said the Spanish killed them but the Spanish said it was the Aztec people who threw rocks and it hit his head and he died a couple of hours later. No one from this day knows who killed Montezuma. Moctezuma which is the correct name, was the eleventh Huey Tlatoani, he was a military and religious leader of te Mexicans, not aztecs, which is a wrong name, he invited the spanish to his palace, he was taken prisor in his own palace, and later died for unknown reasons.