An Islamic state where Christians were kidnapped and enslaved by Muslims deemed to be “barbarians” by the West. An embarrassed U.S. government forced to pay ransoms and tributes to free the hostages.

Such was the situation 200 years ago when, on March 3, 1815, Congress authorized the use of naval force against the Barbary State of Algiers. The Barbary States, made up of Tripoli, Algiers, and Tunis, were loosely affiliated with the Ottoman Empire, which engaged in the slave trade of captured Christians, Mediterranean piracy, and ransoms. In order for countries and their populaces to be protected, hefty tributes had to be paid.

The U.S. had already fought one war against one of the Barbary States and had achieved a major victory against Tripoli. The simplest explanation for that conflict was the ever-rising cost of tribute, or extortion. Ransoms tallied up to millions of dollars.

While the Tripolitan War, or First Barbary War, had resolved the issue of Tripoli, that still left Algiers, which as Frederick Leiner, author of The End of Barbary Terror: America’s 1815 War Against the Pirates of North Africa, notes, “had always been the biggest and the baddest.”

At some point in the first decade of the 19th century the U.S. had gone into arrears with payments of tribute to Algiers. So in 1812, the new Dey (or ruler), Hajji Ali, declared open season on kidnappings and Algiers seized the Edwin, a small merchant ship out of Salem, Massachusetts. While the ship only had a handful of people on board, the capture of its passengers and their potential enslavement was a sore point for the U.S.

However, with the War of 1812, the U.S. government had enough on its plate.

By March of 1815, however, the War of 1812 was over, and the Treaty of Ghent had just been ratified by the Senate in February. A new ruler in Algiers, Dey Omar, was in charge. In addition, the U.S. now had a much stronger navy. While the administration of James Madison was cash-strapped after recently exiting one war, the end of the British blockade and increased trade meant that the issue of piracy needed to be dealt with. In addition, the ransoms and tributes ate up a significant amount of U.S. funds.

“It was in part a money issue, but primarily it was a national honor issue,” declares Leiner, in an interview with The Daily Beast. It was an issue of how these lawless states could have so much power over a country that already had a lofty image of itself. “A self-respecting country should not have to pay bribes to support free trade."

As George C. Herring notes in his seminal From Colony to Superpower, the first Barbary War “had an enormous psychological and ideological significance for the United States. The effective use of force stimulated the self-pride of the new nation.” Yet, even after winning that war, and staving off the British, the U.S. was still being held up by what was essentially an extortionist, rogue state.

The incident with the Edwin in particular stood out. “Madison had never forgotten this one ship, with its people enslaved,” claims Leiner. And so while it was only a handful of captives, and Madison “was not a bellicose guy,” he sought authorization for force from Congress. Far from being slammed as a useless and expensive war halfway across the world, Madison's decision to use force was extremely popular with the American public.

There was also a religious and racial aspect to the desire to go to war. While the Barbary rulers were not ISIS militants dreaming of a new caliphate, there was what Leiner calls “a jihadist-type attitude because they were very conscious that they were seizing Christians … because they regarded them as inferior, as infidels.” And the slavery, he says, “was not benign. The common sailors who were enslaved did all sorts of hard, grueling labor.”

The conflict also “became a morality play,” as Herring writes, as it gave Americans joy “that republican ideals had given them the courage and strength to defeat the ‘plundering vassals of the tyrannical bashaw,’ striking a blow for liberty and Christianity.”

On May 20, the first of the two squadrons set sail to take on the Barbary ships. The expedition was led by none other than Stephen Decatur, whose status as one of the republic’s early Naval heroes would be cemented by the conflict. In short order, two battles, the U.S. made quick work of Algiers’ ships. One of the battles was last frigate-on-frigate battle the U.S. ever fought. Decatur was so successful that the second squadron never saw any action. In return for the ships, Dey Omar agreed to return the slaves from Edwin and that no future tributes would be owed. Similar treaties would be obtained by Decatur in Tunis and Tripoli. Unfortunately for the returned Americans, they would be lost at sea along with their ship, the Epervier.

The U.S. wound up not only winning the war, but also embarrassing European powers who also paid the ransoms and tributes to the Barbary states.

“It made the European countries seem so weak, or feckless,” asserts Leiner. “They were still paying the Barbary powers when this small republic 3,000 miles away decided we’re not going to do this any more.”

As a result, just a year later, the British sent a squadron to Algiers, and pummeled the city. After negotiations, thousands of slaves held there were freed, some of whom had been enslaved for decades.

There are similarities between today’s struggle over whether or not to pay ransoms for American citizens taken captive by ISIS and whether to use a show of force against the jihadis. To draw a direct line between the conflict two centuries ago and the geopolitics of today would of course be misguided. At its most basic level, Algiers was a state actor, and could and did sign and honor treaties. But the faint echoes here are more than siren song. The issues of national pride and the safety of citizens, as well as the religious and cultural tensions, were at the forefront of a risky decision to go to war in 1815. However, just because it was a success then, does not mean it will be now.