Research on autonomous ships has led to several ideas about how they could be operated in terms of level of automation and human presence. However, all seem to point towards systems that will be more complex due to issues such as the tighter integration with software and the interactions with humans-in-the-loop. These ships will likely be completely different compared to conventional ones, which puts into question the usefulness of our current understanding of risk and how it is managed for ensuring safe operation. By a critical review of the literature, this paper highlights the need for advanced methods that will combine machine learning and simulation for dynamically assessing risk in a life cycle context and effectively transferring acquired operational knowledge back to the design phase. The main objective of this paper is to describe a novel life cycle risk framework for developing algorithms inspired by the biological immune system, which provides lifetime protection from harmful pathogens. This framework can be used to construct machine learning algorithms for dynamic risk monitoring and adaptive risk control that address different types of risk, while enabling faster future response to previously unencountered risks and operational feedback to design through learning. We demonstrate the feasibility of our approach in a specific maritime context with a case study on collision risk identification. Considering the lack of experience for autonomous ships, the benefit of our immune-inspired approach is that it departs from the classic risk scenario concept and that it does not rely on safety performance data for identifying risk factors and training the algorithms. We suggest this framework is particularly suitable for autonomous ships with high levels of autonomy, although applicable to conventional ships as well, as it can contribute to empowering them with risk awareness and the capability to deal with any risk environment.