An electromechanical lock comprising: a lock body; a first axle configured to be rotatable; a first permanent magnet pin coupled with the first axle; a second permanent magnet pin coupled with the first axle; a second axle configured to be rotatable; an actuator (206, 216) configured to move between a locked position and an unlocked position; a first permanent magnet coupled with the actuator (206, 216); and a second permanent magnet coupled with the actuator (206, 216); wherein the first axle and the second axle are configured to be couplable with each other, and in the locked position, the first permanent magnet is configured to direct a first magnetic field exerting a pushing force to move the first permanent magnet pin into a contact with the lock body so that rotation of the first axle is blocked, and the second permanent magnet is configured to direct a second magnetic field exerting a pulling force to move the second permanent magnet pin so that the first axle is kept uncoupled with the second axle, whereas, in the unlocked position, the first permanent magnet is configured to direct a reversed first magnetic field exerting a pulling force to move the first permanent magnet pin so that the first axle is released to rotate, and the second permanent magnet is configured to direct a reversed second magnetic field exerting a pushing force to move the second permanent magnet pin so that the first axle becomes coupled with the second axle. a lock body; a first axle configured to be rotatable; a first permanent magnet pin coupled with the first axle; a second permanent magnet pin coupled with the first axle; a second axle configured to be rotatable; an actuator (206, 216) configured to move between a locked position and an unlocked position; a first permanent magnet coupled with the actuator (206, 216); and a second permanent magnet coupled with the actuator (206, 216); wherein the first axle and the second axle are configured to be couplable with each other, and in the locked position, the first permanent magnet is configured to direct a first magnetic field exerting a pushing force to move the first permanent magnet pin into a contact with the lock body so that rotation of the first axle is blocked, and the second permanent magnet is configured to direct a second magnetic field exerting a pulling force to move the second permanent magnet pin so that the first axle is kept uncoupled with the second axle, whereas, in the unlocked position, the first permanent magnet is configured to direct a reversed first magnetic field exerting a pulling force to move the first permanent magnet pin so that the first axle is released to rotate, and the second permanent magnet is configured to direct a reversed second magnetic field exerting a pushing force to move the second permanent magnet pin so that the first axle becomes coupled with the second axle. the first axle and the second axle are configured to be couplable with each other, and in the locked position, the first permanent magnet is configured to direct a first magnetic field exerting a pushing force to move the first permanent magnet pin into a contact with the lock body so that rotation of the first axle is blocked, and the second permanent magnet is configured to direct a second magnetic field exerting a pulling force to move the second permanent magnet pin so that the first axle is kept uncoupled with the second axle, whereas, in the unlocked position, the first permanent magnet is configured to direct a reversed first magnetic field exerting a pulling force to move the first permanent magnet pin so that the first axle is released to rotate, and the second permanent magnet is configured to direct a reversed second magnetic field exerting a pushing force to move the second permanent magnet pin so that the first axle becomes coupled with the second axle.