  In this paper we consider the optimal dividend problem for an insurance
company whose risk process evolves as a spectrally negative L\'{e}vy process in
the absence of dividend payments. The classical dividend problem for an
insurance company consists in finding a dividend payment policy that maximizes
the total expected discounted dividends. Related is the problem where we impose
the restriction that ruin be prevented: the beneficiaries of the dividends must
then keep the insurance company solvent by bail-out loans. Drawing on the
fluctuation theory of spectrally negative L\'{e}vy processes we give an
explicit analytical description of the optimal strategy in the set of barrier
strategies and the corresponding value function, for either of the problems.
Subsequently we investigate when the dividend policy that is optimal among all
admissible ones takes the form of a barrier strategy.
