An electric lock includes a manual operation mechanism and an electric control mechanism. The manual operation mechanism includes a rotary knob unit, a first attracting member mounted fixedly to the rotary knob unit, a key-operated lockset, and a lock-connecting rod connected to and rotatable by the rotary knob unit and the key-operated lockset. The electric control mechanism includes a power source unit, a clutch gear driven by the power source unit to rotate in two directions, and a second attracting member mounted fixedly to the clutch gear. When the clutch gear is driven by the power source unit to rotate to align the first and second attracting members with each other, a magnetic attraction force is generated between the first and second attracting members to allow for co-rotation of the rotary knob unit with the clutch gear.