The invention relates to a rehabilitation mechanism (30) which is designed to be suitable for the rehabilitation of at least the joints muscles and tendons of the legs (92) of a patient (90) confined to bed which rehabilitation is automated in accordance with a plan. The rehabilitation mechanism (30) according to the invention comprises at least the following: a foot module (40) which can be brought into operative connection with the feet (94) of the patient (90) confined to bed a knee module (50) which can be brought into operative connection with the knee joints (93) of the confined patient (90) and a control module (60) for controlling planned rehabilitation motions of at least the joints muscles and tendons of the legs (92) of the patient (90) confined to bed by means of the foot module (40) and/or the knee module (50). The rehabilitation mechanism is additionally characterized in that at least the knee module (50) is designed as a module that can be arranged between the patient (90) and a mattress (20) and that is supported directly or indirectly on a bed frame (11) or a mattress frame (21). The modular design of the rehabilitation mechanism (30) has the advantage that patients (90) who are confined to bed and in particular require intensive care can receive rehabilitation that is automated in accordance with a plan directly in the bed (10) which can be designed in particular as a care bed sick bed hospital bed and/or intensive care bed and indeed also without risky bed transfer and/or possibilities of a patient s own contribution.