Just over a year ago, four U.S. Special Forces soldiers, outgunned and ambushed, lost their lives in Niger fighting against members of the Islamic State.

These American troops, ostensibly there to train and assist a foreign military, found themselves engaged in combat. Their deaths represent a troubling continuation of the perpetual war in which America has found itself since 9/11 — with no end in sight. Tellingly, this war is as old as some of the recruits who are about to fight.

These fatalities represented the largest loss of life sustained by the U.S. military in Africa since the infamous disaster in Somalia in 1993, when much like in Niger, U.S. forces found themselves surrounded and outnumbered. The Battle of Mogadishu was the fiercest urban combat the military had participated in since the Vietnam War, and it left 18 American servicemen and an unknown number of Somalis dead. Images of jeering Somalis dragging an American corpse through the streets infuriated the U.S. public (and Congress), compelling President Bill Clinton to withdraw American forces from Somalia.

Understanding this earlier conflict and its fallout is critical to understanding why the United States has dispatched troops to the Horn of Africa and elsewhere on the continent today. The international community’s hasty withdrawal, along with its conduct during the mission, left a weak, ineffective and corrupt central government in charge.

This lack of leadership produced a security vacuum partly filled by Islamic militants. The attacks of 9/11 convinced U.S. strategists of the need to either deny terrorists safe havens or eliminate them in these “failed states.” As a result, American troops returned to Somalia less than a decade after their ignominious retreat, and today, the country is a key part of the long war on terror.

Just as presidents Trump and Obama inherited the war in Afghanistan, the origins of the Battle of Mogadishu predate Clinton’s inauguration. At the end of his presidency, George H.W. Bush authorized the deployment of U.S. troops to Somalia as part of Operation Restore Hope. While the mission was partly humanitarian in nature — to alleviate famine and allow badly needed aid to reach suffering civilians — such altruism was mixed with realpolitik: access to Somalia’s oil.

Under Clinton, the United Nations assumed control of the international relief effort and greatly expanded its mandate. The U.N. Security Council passed Resolution 814, which shifted the emphasis from peacekeeping to peace enforcement, a subtle but important modification. Rather than preventing conflict and separating belligerents, the United Nations was now responsible for maintaining peace. Perhaps more ominously, the United Nations was also involved in ensuring political reconciliation.

Not all Somali actors welcomed the international community. Early relations between Mohamed Aidid, a Somali factional leader who depicted himself as the nation’s rightful leader because of his role in ousting its former dictator Siad Barre, and the United Nations were tense, albeit cordial. But when Aidid accused the United Nations of meddling in internal Somali politics, the global organization made a blunder: Instead of reconciling with him, it supported one of his rivals, Gen. Mohammed Siad “Morgan,” Barre’s son-in-law.

Aidid quickly turned hostile. Open war between Aidid and the United Nations broke out after the organization’s peacekeepers raided Radio Mogadishu, which it viewed as a legitimate target because it was being used to disseminate pro-Aidid messages. In response, Aidid’s forces launched an ambush that killed at least 24 Pakistani U.N. peacekeepers. Days later the Security Council unanimously passed Resolution 837, supporting Aidid’s arrest.

Ultimately, these efforts culminated in the Battle of Mogadishu in October 1993. U.S. Rangers launched a daytime raid, designed by American generals and supported by Clinton, in one of Aidid’s strongholds in an effort to apprehend him. What had been designed as a quick, low-cost raid quickly escalated into the deadly firefight that left so many soldiers and Somalis dead.

In his memoirs, Clinton intimated that he had not been fully informed about the mission. “I did not envision anything like a daytime assault in a crowded, hostile neighborhood,” he wrote. “I assumed we would try to get him when he was on the move, away from large numbers of civilians and the cover they gave his armed supporters.” Yet that was the situation U.S. soldiers faced, resulting in the debacle in Mogadishu that left Clinton and his foreign policy on the defensive.

Faced with intense scrutiny, the White House instituted a phased withdrawal from Somalia, leaving a security vacuum in the country that continues to the present. While Somalis have been blamed for these developments, the United States and the international community should also be faulted for exacerbating Somalia’s internal political dynamics and engaging in crimes that angered Somalis.

For some observers, the botched raid and Clinton’s retreat emboldened radicals such as Osama bin Laden, who believed they had found the Americans’ Achilles’ heel: The United States could not countenance casualties. In 1996, bin Laden taunted the Clinton administration about its withdrawal: “You left carrying disappointment, humiliation, defeat and your dead with you.” Some commentators have even alleged that bin Laden’s organization was also intimately involved in the Battle of Mogadishu, though this remains a subject of contention.

But one thing is undoubtedly true: Weak or despotic central governments often provide the necessary space for extremist organizations or movements to proliferate. Realizing how instability in Afghanistan incubated bin Laden’s organization, the Pentagon dispatched elite U.S. commandos to help topple the Taliban after 9/11. Almost 18 years later, U.S. troops still remain.

Shortly after the Taliban’s defeat, U.S. Special Forces returned to Somalia, this time to combat groups like al-Qaeda.

This was just the beginning. The presence of Special Forces — key players in counterterrorism efforts — has expanded dramatically in Africa since 2001, as the war against bin Laden’s organization spread to the Horn of Africa. According to the journalist Nick Turse, just 1 percent of all U.S. Special Forces commandos deployed overseas served in Africa in 2006. By 2016, that figure had surged to 17 percent. As he noted, outside of the broader Middle East, more elite operatives serve in Africa than anywhere else on the globe.

In 2017, an American soldier was killed in Somalia during an operation against al-Shabab, an Islamic militant group affiliated with al-Qaeda. Previously, U.S. activity had been confined to drone strikes, which have also increased, and assisting and training the Somali military. The serviceman’s death was also the first American combat fatality there since the Battle of Mogadishu. At the time, commentators worried about whether the United States was committing itself to a “long war” in Somalia.

But the question came too late. The United States has been engaged in such a war across the African continent for over a decade. As the U.S. military expands its commitment in the region, the risk grows that it might find itself involved in another dramatic Somalia-style firefight, especially as it appears the military is once again becoming embroiled in tribal disputes and clan warfare. If and when such a scenario occurs, the U.S. public and civilian and military policymakers should inquire whether such missions are combating terrorism or engendering it.

Aggressive commando raids, military training and drone strikes have failed to prevent the spread of radical networks across the globe. Despite expanded U.S. military activity in Somalia and elsewhere, Washington is no closer to defeating its nebulous enemy than it was 17 years ago. All of this means that the answer might prove shocking.