  We propose an analytical solution to the on-off problem within the framework
of Bayesian statistics. Both the statistical significance for the discovery of
new phenomena and credible intervals on model parameters are presented in a
consistent way. We use a large enough family of prior distributions of relevant
parameters. The proposed analysis is designed to provide Bayesian solutions
that can be used for any number of observed on-off events, including zero. The
procedure is checked using Monte Carlo simulations. The usefulness of the
method is demonstrated on examples from gamma-ray astronomy.
