Seven years after Libya’s revolution, the country is a failed state with a humanitarian crisis and a serious threat to US national security. America’s enemies and adversaries, including ISIS, Al Qaeda and Russia, are exploiting the collapse and establishing themselves in Libya at America’s expense, while the United States is not paying attention and not preparing for the gathering storm.

American inaction in Libya is not neutrality. It is failure. Reasons for this abound. The United States has outsourced the Libyan political crisis to a United Nations mission while pursuing a failed strategy to defeat ISIS with military action through airstrikes and support for local forces.

But military victory is impossible despite the temporary disruption of ISIS safe havens. Instability and absent governance allow ISIS and other Salafi jihadi groups, including Al Qaeda, to operate in Libya. A U.S. policy that is militarized and focused on ISIS also fails to address the strategic value of Libya, which is a battleground in a regional proxy war and a theater for Russia’s expansion into the Mediterranean.

ISIS is rising again in Libya. It is recovering from the loss of its urban stronghold in late 2016 and is now disrupting oil production and expanding its reach southward. ISIS is using Libya as its primary foothold in Africa to receive foreign fighters from Europe and its embattled Middle Eastern strongholds, to continue the unprecedented mobilization of sub-Saharan jihadists, and as a base from which to plan and coordinate attacks against the West.

As long as conditions of conflict, social grievance, and absent governance create fertile ground for them, ISIS, Al Qaeda and like-minded groups will return time and again. No military defeat the United States could inflict on them would be enough to prevent them from reemerging in this environment.

Libya is not just a counterterrorism problem, it is also a geopolitical one. Russia is taking advantage of the American retreat from Libya to expand its military and economic influence and undercut American interests in Europe, Africa and the Middle East. Russia’s plan in Libya is similar to its policy in Syria, where it has supplanted U.S. influence and established military bases on the Mediterranean.

Moscow is building ties with power brokers across the Libyan political spectrum and amassing influence in the Libyan oil sector, as well as leveraging its engagement in Libya to foster military cooperation with Egypt. Russia will also use its power in Libya to pressure southern European states sensitive to the flow of energy and migrants from Libya. It will try to apply that pressure to weaken the Euro-American alliance and induce passivity in the face of Russian aggression against Eastern Europe.

The forecast for Libya in 2018 is gloomy. The presidential and parliamentary elections, tentatively planned for late 2018, are more likely to incite conflict than to unify Libya, especially in the absence of a constitution. Violence related to the election has already begun. No single faction is strong enough to stabilize the country.

Even would-be strongman Khalifa Haftar is weakening, dependent on uncontrollable militias and watching security crumble in the largest city under his control. Dangerous currents are rising in the vacuum. Anti-democratic Salafi militias are taking on the role of police. Sectarian and ethnic tensions are rising. Hopeful trends in Libya, like increasingly active municipal governance, will wither without support.

The worst-case scenario for Libya is more dangerous than American policymakers have been willing to contemplate. Current events are likely to cause conflict at the local level and could reignite a countrywide armed conflict. This would draw away security forces currently fighting ISIS, hastening its regrowth.

A return to war would also allow Al Qaeda-aligned groups to reenter the fray and recover from their 2016 and 2017 setbacks. Increased Salafi jihadi activity would provide justification for Russia to establish military bases in Libya, mirroring its Syria intervention on a smaller scale. Chaos in Libya would also worsen the humanitarian crisis by preserving a slavery economy, exacerbating migration to Europe, and destabilizing neighboring states that already face major domestic challenges.

But all is not lost. Libya’s population is small and remarkably resistant to the coercion and blandishments of Salafi jihadi groups. U.S. action in Libya would provide an opportunity to strike a blow against the global Salafi jihadi movement and take a stance against Russian expansion. An effective political and military intervention now would be more successful — and cheaper — than one later, after problems spin out of control.

The United States could start by empowering the State Department to facilitate a negotiated settlement between all of Libya’s key factions. It could also pressure regional allies to cease support for Libyan proxies, especially armed groups that have an interest in continuing the war. The United States must lead and cannot miss an opportunity to turn Libya from a failure into a success.

Emily Estelle is a senior analyst with the Critical Threats Project at the American Enterprise Institute. She is the author of the report “A Strategy for Success in Libya.”