This paper examines a problem related to the optimal risk management of banks in a stochastic dynamic setting. In particular, we minimize7 market and capital adequacy risk that involves the safety of the securities held and the stability of sources of funds, respectively. In this regard, we suggest an optimal portfolio choice and rate of bank capital inflow that will keep the loan level as close as possible to an actuarially9 determined reference process. This set-up leads to a nonlinear stochastic optimal control problem whose solution may be determined by means of the dynamic programming algorithm. The above analysis is reliant on the construction of continuous-time stochastic models for bank11 behaviour upon which a spread method for loan capitalization is imposed. 2006 Published by Elsevier Ltd.13