Panic is a status effect caused by things like the spell Horror.
Gameplay[]
Besides methods that directly cure the effect (see infobox to the right), if the panic effect is caused by a spell (like Horror), as it commonly is, then it can also be removed by a successful Dispel Magic. Likewise, in this case the effect could be prevented by blocking the spell before it hits (e.g. Globe of Invulnerability...).
Bugs[]
Unfortunately, some enemies' scripts prevent them from acting correctly when panicked, causing them to continue to act normally despite the panic effect (eg attacking the party relentlessly). This is the case with enemies like most Category:goblins and mephits and is caused by those scripts missing the line "ActionListEmpty()" within their IF conditions.
For example, in Irenicus' Dungeon, goblins carrying shortbows will always react appropriately to being under the effect of 'panic', while goblins carrying axes (all of whom have a different script: KOBOLDF.BCS) will always ignore the condition. Merely adding the missing line to the axe-carrying goblins' script fixes the issue.