Though St. Patrick’s Day is a holiday about Ireland that’s perhaps most famously celebrated in the United States, one of the more festive St. Patrick’s Day venues is Mexico City. There, in the city’s San Jacinto Plaza, a plaque commemorates the “martyrs” of St. Patrick’s Battalion who gave their lives to the Mexican cause.

Also known as the “San Patricios,” that group consisted largely of Irish natives who defected from the U.S. Army during the 1846-48 Mexican-American War, fought over disputed boundaries and the American annexation of Texas. Accounts differ as to the exact number of San Patricios, but it likely exceeded 200 at the group’s peak.

Their exact motives for switching sides have never been established concretely – and very possibly some battalion members had different motives than others – but harsh treatment and anti-Catholic prejudice are viewed as the main factors in their defection to Mexico’s Army.

Many of these Irish soldiers had joined the U.S. Army not for reasons of patriotism but “mainly for job security,” as described by Dennis J. Wynn’s book The San Patricio Soldiers: Mexico’s Foreign Legion. A military career was one of few ways to make ends meet in their new nation, where employment discrimination against the Irish was common. But their “job security” came with a price: Foreign-born soldiers were targeted for abuse by bigoted officers and typically received harsher punishments than native-born soldiers for the same infractions.

Robert Ryal Miller’s book Shamrock and Sword: The Saint Patrick’s Battalion in the U.S.-Mexican War relates that, for rather minor transgressions, a foreign-born soldier might be tied to a cannon or wheel for hours beneath a scorching sun. Or he might receive lashes until his back looked like raw meat. Or he might be branded with such letters as “HD” for “habitual drunkard” or “W” for “worthlessness.” Even execution was a possibility.

Another item of provocation was that, despite the huge Catholic population among its troops, the U.S. Army was not providing sufficient Catholic clergy, and many Catholic soldiers who became gravely injured or ill had been unable to receive the sacrament of last rites.

Trying to capitalize on the U.S. Army’s prejudicial climate, the Mexican government launched a propaganda campaign targeting Catholic soldiers, seeking to persuade them to abandon their Catholic-bashing officers and join the Mexicans — who, not coincidentally, were also Catholics. For those soldiers who lacked sufficient religious indignation, the Mexican government promised cash incentives and land grants.

Get our History Newsletter. Put today's news in context and see highlights from the archives. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Though the San Patricios fought on Mexico’s side in five battles against U.S. forces, they are best remembered for their valor in the Battle of Churubusco, which took place outside of Mexico City. During this Aug. 20, 1847, battle, the Mexican soldiers reportedly tried on three occasions to raise a flag of surrender, but the San Patricios — aware of the likely grisly treatment in store for them should they be captured by the Army from which they had deserted — frantically ripped down the flag each time. However, it was a doomed struggle: They were running out of bullets, and no amount of defiance could overcome an absence of ammunition.

Churubusco was calamitous for the San Patricios. Within three hours of combat, more than half either had been killed or captured. But their fighting intensity left an impression on the Mexican commander, Antonio López de Santa Anna, who later said that he would have won the battle if he had a few hundred more San Patricios.

After that battle, as the Americans advanced toward Mexico City, a U.S. victory in the war was all but inevitable. The Mexicans tried to secure the release of the captured San Patricios, but the Americans were unwilling to negotiate on this matter. Some 72 San Patricios were charged with having deserted the U.S. Army, which wasted little time in bringing them to trial. At least six pled guilty. Dozens of them claimed that, while drunk, they were seized by Mexicans and physically coerced into joining the San Patricios. This drunkenness defense, though unlikely, was not entirely implausible. But the courts were in no mood to consider it.

Within less than one month, 50 of the captured San Patricios were hanged. Incensed by these hangings, the Mexican people rioted and tried to get at their army’s collection of American prisoners, but they were thwarted by the Mexican authorities before exacting their vengeance.

Though greatly reduced in numbers, the San Patricio Battalion actually continued as a unit after the Mexican-American War ended in 1848. Its members were used to protect Mexican civilians from bandits until budget cuts eventually saw the Battalion disbanded about a year later. Some members remained in Mexico, while others petitioned the government to send them back to their ancestral homeland.

The San Patricios were largely reviled in the U.S., where many people ignored the part of the story in which prejudiced treatment of the Irish soldiers had contributed to their defection. Nativists cited their example as proof that Catholic immigrants — and the Irish in particular — had no loyalty to America and should be neither trusted nor welcomed.

On the other hand, the Mexicans viewed the San Patricios as heroes and began naming streets in their honor. Tribute is paid to them each year on September 12 — the anniversary of their mass hanging — as well as on St. Patrick’s Day.

Contact us at letters@time.com.