In the spring of 1866, a band of Irish-Americans who fought on both sides of the Civil War united to undertake one of the most fantastical missions in military history: invade the British province of Canada, seize the territory and ransom it back to the British for Ireland's independence.

It may sound like complete blarney, but it actually happened. And not just once, but five times between 1866 and 1871, in what are collectively known as the Fenian Raids.

While the United States and its northern neighbor currently share the longest peaceful international border in the world, that wasn’t always the case. During America’s first century, the U.S. and Canada were uneasy neighbors. Armed conflicts erupted periodically along the boundary line, which was a no-man’s land frequented by counterfeiters and smugglers. American anger toward Canada surged during the Civil War when it became a haven for draft dodgers, escaped prisoners of war and Confederate agents who plotted hostile covert operations—including raids on border towns, the firebombing of New York City and the assassination of President Abraham Lincoln.

READ MORE: The Irish Brigade

Fenians like John O’Neill imported their anti-British fervor across the pond.

To the Irish-American members of the Fenian Brotherhood, which sought to end 700 years of colonial rule by England in Ireland, Canada was a natural target. Why? Because it was the nearest parcel of the British Empire to the U.S.

Like many Fenians, John O’Neill could never forgive the British for the horrors he had witnessed as a boy coming of age during the Great Hunger. After the Emerald Isle had endured seven centuries of attempts by its occupying neighbor to exterminate its culture, many Irish saw the lackluster British response to their catastrophic potato crop failure in 1845 as nothing less than an endeavor to eradicate them altogether.

Radicalized by the Great Hunger and his grandfather’s tales of 17th-century ancestors who dared to take up arms against the Crown, the teenaged O’Neill joined hundreds of thousands of Irishmen fleeing to the United States. When the Civil War broke out, he joined the Union Army, sustained serious injuries during the siege of Knoxville and had a horse shot out from under him during the Peninsular Campaign.

That conflict, however, served as a training ground for the real war he wished to wage—a revolution to overthrow British rule in Ireland.

The simple logic of attacking the British just over the American border—rather than an ocean away in Ireland—seduced O’Neill to join the Fenian Brotherhood. “Canada is a province of Great Britain; the English flag floats over it and English soldiers protect it,” he wrote. “Wherever the English flag and English soldiers are found, Irishmen have a right to attack.”

READ MORE: When America Despised the Irish: The 19th Century's Refugee Crisis

Hulton Archive/Getty Images
Fenians take possession of St. Armand in Canada during the Fenian Invasions, June 1866. 

The White House wasn’t opposed to the plan.

Far from some whiskey-fueled daydream, the Irish-American plan to invade Canada was carefully crafted for months by veteran Civil War officers, including the one-armed general Thomas William Sweeny. Although an attack on a foreign country with which the United States maintained peaceful relations ran afoul of American neutrality laws, the plan also had the tacit approval of the White House.

Indeed, President Andrew Johnson proved more than willing to let the Fenian Brotherhood twist the tail of the British lion as he sought to pressure Great Britain to pay reparations for the damage caused by Confederate warships, such as the CSS Alabama, that had been built in British ports. In addition, many Americans hoped Canada would become the next territory to be absorbed by the United States as it fulfilled its expansionist Manifest Destiny. The U.S. govern­ment sold surplus weapons to the Irish militants, and Johnson met personally with their leaders, reportedly giving them his implicit backing. The Irishmen were free to establish their own state in exile—complete with their own president, constitution, currency and capital in the heart of New York City.

READ MORE: How Stereotypes of the Irish Evolved from Criminals to Cops

First forays across the border were victorious.

Summoned to the battlefront in late May 1866, O’Neill left behind his wife, two-month old son and business worth $50,000 in Nashville to attack Canada. When the invasion’s commanders failed to show in Buffalo, New York, O’Neill was given the reins to the 800-man attack force, which called itself the Irish Republican Army.

In the early morning hours of June 1, 1866, O’Neill fulfilled a lifelong dream by leading his men across the Niagara River and the international border. “The governing passion of my life apart from my duty to my God is to be at the head of an Irish Army battling against England for Ireland’s rights,” he declared. “For this I live, and for this if necessary I am willing to die.”

O’Neill proved to be a talented commander and tactician when he confronted a combined British and Canadian force the following day outside the village of Ridgeway, 20 miles south of Niagara Falls. Although outnumbered, the grizzled army of Civil War veterans used its experience to rout a makeshift defense force that included farm boys and University of Toronto students who had never once fired a gun. O’Neill followed that up with another triumph in a guerilla fight through the streets of Fort Erie.

It marked the first Irish military victory over forces from the British Empire since 1745.

READ MORE: 7 Times the U.S.-Canada Border Wasn't So Peaceful

The Cartoon Collector/Print Collector/Getty Images
A cartoon illustrating a Canadian kicking a representative of the Irish Fenian movement out of Canada and back to America where President Grant is waiting.

Failures followed.

The attack made front-page news across the country, and Irish-Americans poured into Buffalo to join the fight. The American government, however, severed the Fenian supply lines in what the Irishmen saw as a betrayal by Johnson. Forced to retreat, O’Neill shook hands with nearly two dozen prisoners of war, informed them they were again free men and vowed to return to Canada soon.

He would be a man of his word. After assuming the leadership of the Fenian Brotherhood, O’Neill launched further attacks on Canada in 1870 and 1871. They failed utterly and in one instance comically, when O’Neill seized two buildings he thought to be in Canada that turned out to be firmly in the United States.

O’Neill and the Fenian Brotherhood may not have delivered independence to Ireland, but they left a lasting legacy. They made the United States a player in Anglo-Irish relations—a role that continues to this day in Northern Ireland. And they demonstrated that America could provide Irish republicans with a base of operations beyond the legal reach of the British government from which they could raise money, ship arms and plot military operations. The transatlantic revolutionary structure established by the Fenians would prove vital more than 50 years later when Ireland eventually gained its freedom.

The Fenian Brotherhood did succeed, however, in forging the creation of a new nation—just not the one it intended. Concerned about the inability of the British government to defend its border from an invasion from the south, Canada gained the right to self-government in 1867, pointing it toward its ultimate independence.

Christopher Klein is the author of four books, including When the Irish Invaded Canada: The Incredible True Story of the Civil War Veterans Who Fought for Ireland's Freedom.

History Reads features the work of prominent authors and historians.