Action that can be undertaken to achieve political ends

Terrorism is one form of action that can be undertaken to achieve political ends. Insurgents may sometimes use terrorist tactics as part of their efforts to undermine and defeat their enemies. In spite of the use of similar tactics, it is generally acceptable for states to negotiate with insurgent groups, while negotiation with terrorist groups is seen as unacceptable. Given the discussion of these two kinds of nonstate violence, why have states treated these kinds of opponents so differently?