Riley was born in Clifden, County Galway, Ireland around 1817–1818; his original Irish name is Seán Ó Raghailligh. Riley served with the British Army before emigrating to Canada. Connemara and other rural regions suffered greatly during the Great Famine, and millions of people emigrated by ship from Ireland to Canada and the United States to survive. Riley was among them.
Soon after his arrival in the United States in Michigan, Riley enlisted in the US Army. Many immigrants were recruited in the 1840s; some served just to earn some money, as they had usually fled famine and severe poverty in their home countries.
Prior to his desertion, Riley served in Company K of the 5th US Infantry Regiment. Riley and Patrick Dalton formed the Batallón de San Patricio, or the Saint Patrick's Battalion. It was made up of mostly Irish and German immigrants, although it included Catholics from many other countries as well, plus some African Americans who escaped from slavery in the American South. The unit deserted in 1846 just before the war's beginning and fought at several battles and finally at the Battle of Churubusco, on the outskirts of Mexico City, where more than 70 were captured by US forces and the rest disbanded. Men of the disbanded battalion went on to fight at the Battle for Mexico City.
Because Riley had deserted before the US declared war against Mexico, he was not sentenced to execution following his conviction at the court martial held in Mexico City in 1847. He testified to deserting because of discrimination against and mistreatment of Irish Catholics in the US Army, and anti-Catholicism which he had encountered in the United States. While escaping the mass hanging of about 50 other captured members of the Saint Patrick's Battalion, Riley was branded on his cheek with the letter "D" for deserter.
Following his conviction and branding, Riley was released and eventually rejoined the Mexican forces. Reportedly he grew his hair to conceal the scars on his face. He continued to serve with the regular Mexican Army after the end of the war, being confirmed in the rank of "Permanent Major". Stationed in Veracruz, he was retired on 14 August 1850 on medical grounds after suffering from yellow fever.
Robert Ryal Miller, author of Shamrock and Sword (1989), found what appeared to be Riley's death certificate in book of burials No. 6, entry 133, of the then parish (now cathedral) of Veracruz . Like Riley's Mexican army records, it refers to the name "Juan Reley". It reads:
"In the H. [Heroic] city of Veracruz, on the thirty first of August of eighteen hundred and fifty, I, Don Ignacio Jose Jimenez, curate of the parish church of the Assumption of Our Lady, buried in the general cemetery the body of Juan Reley, of forty five years of age, a native of Ireland, unmarried, parents unknown; died as a result of drunkenness, without sacraments, and I signed it."
However, while Miller at the time believed this was in fact the death certificate of the San Patricio commander, both his own research and that of subsequent scholars suggest that he was mistaken. Miller died in 2004 before he could write an addendum. Some arguments which cast doubt on Miller's original presumption include:The U.S. Army enlistment records from September, 1845 indicate that John Riley was born in Clifden, Co. Galway, and was twenty-eight years old at the time of his enlistment. That would mean he had been born between 1817 and 1818 so would have been 33 years old in 1850.The Juan Riley buried in the churchyard was 45 years old according to the curate. It could not have been the leader of the San Patricios.
Major Riley was a teetotaler and his sobriety, leadership, ambition and example was commented on by several people who knew him. Even those who condemned his desertion were aware of these qualities. A death from drunkenness would have been highly unlikely.
Riley had been discharged on 14 August with medals for heroism, with uniforms, with a well-equipped horse and tack, with over $800 in retirement pay (the equivalent of $20,000 today). The death certificate for the indigent "Juan Riley" was dated 31 August, just seventeen days later.
No robbery was mentioned in any newspaper in Veracruz during this period, nor were there any police reports of big spenders. In such a small town they would have been noticed. Thus is highly unlikely that the well-known and highly decorated major, a redhead over six feet tall and handsome except for his scars, would have been suddenly impoverished and buried (as "Juan Riley") without last rites in the general cemetery just weeks after his discharge.
Research conducted in September 2012 in Clifden, Co. Galway failed to turn up any John Riley who would fit into the age described on the death certificate. Peter F. Stephens, author of The Rogue’s March: John Riley and the St. Patrick’s Battalion, agrees that the only Rileys which fit the profile had to be born in County Galway in 1818, a year that marks the birth of two male children to two different families each of whom were named John Riley, both of which were duly recorded by the Catholic Church records in Clifden, Co. Galway.
In his honor, and to commemorate Saint Patrick's Battalion, a bronze sculpture was erected in his birthplace of Clifden, Ireland, as a gift from the Mexican government.
Riley is featured prominently in James Carlos Blake's 1999 historical fiction novel In the Rogue Blood.
In the 1999 film One Man's Hero Riley was portrayed by Tom Berenger.
There is also a song about Jon Riley from the Irish folkband Shantalla.
In music, Riley's story is the subject of Tim O'Brien's song "John Riley", and features in his album The Crossing. David Rovics also sings of Riley in "Saint Patrick's Battalion". The Street Dogs sing about the Battalion and Riley in "San Patricios " on their album State of Grace.
In historical-fiction, Riley features in James Alexander Thom's novel St Patrick's Battalion: A Novel of the Mexican-American War, 2008.
A half-hour documentary Saol John Riley (The Life of John Riley) was broadcast on the Irish language television channel, TG4 in 2011. Directed by Kieran Concannon, it followed the Irish singer songwriter Charlie O'Brien as he traced the path of Riley's journey from Clifden to Veracruz.