The most important piece of European legislation relevant to risk assessment is the Framework Directive 89/391. This Directive is indeed a framework, with "general principles concerning the prevention of occupational risks… as well as general guidelines for the implementation of the said principles" (Art. 1.2.). It makes employers responsible for ensuring the safety and health of workers in every aspect related to work, and risk assessment is an integral aspect of this mandatory occupational safety and health management (OSHM). According to the Directive, risk assessment must be the starting point of a comprehensive OSHM process. It has a central role because it enables employers to put in place the measures that are necessary to protect the safety and health of their workers.
The Framework Directive has been transposed into national legislation. Member States, however, have the right to introduce more stringent provisions to protect their workers (for this reason you should check the specific legislation relating to risk assessment in your country).