In this paper we develop a framework for optimal investment decisions for insurance companies under unhedgeable risk. The perspective that we choose is from an insurance company that tries to maximise the stream of dividends paid to its shareholders. The policy instruments that the company has are the dividend policy and the investment policy. The insurance company can continue to pay dividends until bankruptcy, and hence the time of bankruptcy is also endogenously controlled by the dividend and investment policies. Using stochastic control theory, we derive simultaneously the optimal investment policy and the optimal dividend policy, taking the insurance risks to be given.