Why did Iran sign on to a deal that will weaken its regional hold?

So why did Iran sign on to a deal that will undermine its regional strategy? The obvious answer is that economic sanctions forced Iran to choose between political stability at home and hegemony over the region. On that score, then, the nuclear deal has in one swoop ended Iran’s nuclear threat and hobbled its regional agenda.
But equally important is that Iran’s main regional worry has become the so-called Islamic State. The extremist Sunni force has emerged as an anti-Shiite and anti-Iranian juggernaut that now controls vast territory in Iraq and Syria and is a growing presence in Afghanistan. The Islamic State has the potential to expand into other Sunni Arab states and thereby present Iran and its Shiite allies with a significant strategic threat.
Iran has been fighting the Islamic State in Iraq and Syria, and it could be doing the same in Afghanistan before long. This could be a long war, and that reality has forced Iran to rethink its strategic calculus. Confronting the Islamic State requires not a nuclear umbrella but a reduction of tensions with the international community and greater economic resources. The threat of the Islamic State, more so than any promise of hegemony over the region, was likely a decisive factor in Iran’s decision to sign away the nuclear cover for its regional strategy.