Touch of Madness has pretty low range. Did you script your mages to cast the spell? If they were ordered to cast it and the longbows were the only target in range, they couldn't have done otherwise.
Sometimes the mages decide to cast berserk spells on stupid targets on their own, and that is indeed a problem, but it's quite rare. It's most annoying when they target other mages.
