The origin of terrorism is always ideology, this is invariably so irrespective of the ideological affiliation of the terrorists in question. The ideology that incites and produces terrorism is the root cause of terrorism and not socio-economic factors as social scientists relying on the Marxist doctrine of historical materialism will tell us.
Imagine if the US after the September 11, 2001 mass attacks against the United States had embarked on a major well-funded global multi-year campaign to discredit Jihadism and Islamism, replete with tens of billions of dollars to fund pro-democratic liberal islam in the United States and worldwide? The US tragically did not do so and instead focused narrowly on militarily fighting the terrorists in only thus focusing on the tip of the iceberg visible above water while ignoring the vast majority of the iceberg under the water. The US policy failure on Islamdom was predictable, the question is now whether the US government will learn from twenty years of failed policy in consistently ignoring the political dimension of the cold war with Islamism/Jihadism?
The task at hand is neither difficult nor insurmountable and that is to comprehensively discredit the political ideologies of Jihadism and Islamism in all parts of the world among Muslims, inside Islamdom and throughout the Muslim world at large. This is a fitting task for the US intelligence community as soft power is indeed a strong side of the US. The toolbox is well-established (including mobilizing Hollywood) and it does not even require propaganda. Discrediting totalitarianism is neither difficult nor an insurmountable challenge and should have long since have been a main response to the global Jihadist threat.
Once the US identifies and commits to fighting the root causes of Muslim terrorism will the US find that its credibility and influence will rise to a spectacular degree in capitals throughout Islamdom. Furthermore, the US will likely be able to bring the global cold war with Islamism/Jihadism to a successful conclusion far earlier than would otherwise be possible.