If trade barriers are “second-best” policies with costs to consumers that are significantly greater

If trade barriers are “second-best” policies with costs to consumers that are significantly greater than their benefits to producers, why are trade barriers enacted? Explain.