Insurance business considered is modelled by a compound Poisson process with the Black-Scholes type market index. The authors show that the ruin probability of this risk process is minimized by the choice of a suitable investment strategy for a capital market index. Let $T(t)$, $t \geq 0,$ be the surplus process. The optimal invested amount $A_t$, $t \geq 0,$ at time $t$ has the following properties: the amount of money $A_t = A(T(t))$; $A(0) = 0$; the derivative $A'$ has a pole at $0$; the function $A$ remains bounded for exponential claim sizes, and it is unbounded for heavy-tailed claim size distributions. The result is obtained with the aid of the Bellman equation - a second order nonlinear integro-differential equation - which characterizes the value function and the optimal strategy. More explicit solutions are determined when the claim size distribution is exponential, in which case a numerical example is also provided. Another example refers to the case of Pareto claim size.
Using in the model a Brownian motion with drift in place of the compound Poisson process, {\it S. Browne} [Meth. Oper. Res. 20, 937-958 (1995;

Zbl 0846.90012)] obtained the quite different result: the optimal strategy is the investment of a constant amount of money in the risky asset, irrespectively of the size of the surplus.