Lock for a door or window having a movably mounted leaf, comprising: - a lock mechanism having at least one latch and a lock follower for operating the bolt and a selection mechanism co-operating with the lock follower, it being provided that the lock follower is designed as a three-part follower having an inner follower, a first outer follower and a second outer follower as well as a coupling mechanism comprising a first coupling member and a second coupling member, - the inner follower is disposed between the first outer follower and the second outer follower and the first outer follower can be coupled with the inner follower by means of the first coupling member and the second outer follower can be coupled with the inner follower by means of the second coupling member, - the selection mechanism has an electric actuator for actuating the first and/or the second coupling member, it being provided that the output of the electric actuator has a rotatably mounted cam mechanism or co-operates therewith and the cam mechanism co-operates directly or indirectly with the first coupling member and/or with the second coupling member, it being possible, depending on the design of the cam mechanism, to obtain at least three of the following configurations of coupling of the outer followers (1a, 1c) with the inner follower, i) first outer follower coupled with the inner follower and second outer follower uncoupled from the inner follower; ii) first outer follower uncoupled from the inner follower and second outer follower coupled with the inner follower; iii) first outer follower coupled with the inner follower and second outer follower coupled with the inner follower; iv) first outer follower uncoupled from the inner follower and second outer follower uncoupled from the inner follower, characterised in that an output shaft of the electric motor is connected in a rotationally fixed manner to a worm gear comprising a worm screw and a worm wheel, and the worm wheel is connected in a rotationally fixed manner to the cam mechanism, and the cam mechanism has a first cam which co-operates indirectly or directly with the first coupling member and a second cam which co-operates indirectly or directly with the second coupling member, and the first cam and the second cam are disposed axially spaced apart from one another on the cam mechanism. - a lock mechanism having at least one latch and a lock follower for operating the bolt and a selection mechanism co-operating with the lock follower, it being provided that the lock follower is designed as a three-part follower having an inner follower, a first outer follower and a second outer follower as well as a coupling mechanism comprising a first coupling member and a second coupling member, - the inner follower is disposed between the first outer follower and the second outer follower and the first outer follower can be coupled with the inner follower by means of the first coupling member and the second outer follower can be coupled with the inner follower by means of the second coupling member, - the selection mechanism has an electric actuator for actuating the first and/or the second coupling member, it being provided that the output of the electric actuator has a rotatably mounted cam mechanism or co-operates therewith and the cam mechanism co-operates directly or indirectly with the first coupling member and/or with the second coupling member, it being possible, depending on the design of the cam mechanism, to obtain at least three of the following configurations of coupling of the outer followers (1a, 1c) with the inner follower, i) first outer follower coupled with the inner follower and second outer follower uncoupled from the inner follower; ii) first outer follower uncoupled from the inner follower and second outer follower coupled with the inner follower; iii) first outer follower coupled with the inner follower and second outer follower coupled with the inner follower; iv) first outer follower uncoupled from the inner follower and second outer follower uncoupled from the inner follower, characterised in that an output shaft of the electric motor is connected in a rotationally fixed manner to a worm gear comprising a worm screw and a worm wheel, and the worm wheel is connected in a rotationally fixed manner to the cam mechanism, and the cam mechanism has a first cam which co-operates indirectly or directly with the first coupling member and a second cam which co-operates indirectly or directly with the second coupling member, and the first cam and the second cam are disposed axially spaced apart from one another on the cam mechanism. i) first outer follower coupled with the inner follower and second outer follower uncoupled from the inner follower; ii) first outer follower uncoupled from the inner follower and second outer follower coupled with the inner follower; iii) first outer follower coupled with the inner follower and second outer follower coupled with the inner follower; iv) first outer follower uncoupled from the inner follower and second outer follower uncoupled from the inner follower, characterised in that an output shaft of the electric motor is connected in a rotationally fixed manner to a worm gear comprising a worm screw and a worm wheel, and the worm wheel is connected in a rotationally fixed manner to the cam mechanism, and the cam mechanism has a first cam which co-operates indirectly or directly with the first coupling member and a second cam which co-operates indirectly or directly with the second coupling member, and the first cam and the second cam are disposed axially spaced apart from one another on the cam mechanism.