Photo via Wikimedia Commons

With the U.S. annexation of Texas in 1846, tensions with Mexico had reached a critical point. At the same time, many Irish Catholics were immigrating to America in the wake of famine and unrest in Ireland.

In the Army, as with the rest of the country, the Irish Catholics faced discrimination, and were often given dirty, lowly jobs.

Mexican generals learned of the plight of the Irish soldiers and took advantage of it — offering land, money, and potential for advancement for any soldier who deserted and joined them. The prospect of defecting to fight for Mexico meant better conditions overall. Unlike the U.S. Army, the Mexican Army treated the Irish like heroes.

Originally, the immigrants were assigned to the “legion of foreigners” under the Mexican Army. After the Battle of Resaca de la Palma — one of the earliest battles of the Mexican-American War — the legion was organized into the St. Patrick's Battalion.

Many of the defectors had prior artillery experience, and they were assigned as an elite artillery unit. Though it consisted mainly of Irish Catholics, a handful of other nationalities were also included.

Related: The most interesting war tactics of all time, according to the internet »

Their banner included a bright green standard with an Irish harp, under which read the words “Erin go Bragh,” meaning “Ireland forever,” paired with the Mexican coat of arms with the words “Libertad por la Republica Mexicana.” On the reverse side was an image of St. Patrick and the Spanish iteration of his name, “San Patricio.”

During the battles of Buena Vista and Churubusco, the St. Patrick’s battalion was led by Irish defector John Riley, formerly of Company K under the U.S. Army’s 5th Infantry Regiment, according to the Texas Historical Association.

The Battle of Churubusco did not go well for the battalion, however.

On Aug. 20, 1847, the U.S. Army was in position to take the bridge over the Churubusco River and enter the city. The Mexican defenders, including the St. Patrick’s Battalion, managed to stave off the attack under Gen. Gabriel Valencia earlier in the day. But they later ran out of ammunition, which led to their surrender.

During the skirmish, most of the battalion was captured or killed.

According to Latin American history expert Christopher Minster, 85 members of the battalion were taken prisoner. Seventy-two of them were tried for desertion. Though some were pardoned, 50 of them were hanged, and one was shot.

Riley, however, was not among those executed. He was instead whipped and branded by the U.S. Army.

Today, the U.S. Army still considers the St. Patrick’s Battalion as traitors. But in Mexico they are highly regarded. There, St. Patrick's Day is celebrated particularly in the places where the Irish soldiers were hanged, Minster wrote.

WATCH NEXT: