Apparatus (10,110) for removing a section of casing or lining from a wellbore, the apparatus comprising: a tubular mandrel (12,112) arranged to be connected in a tubular string for inserting the apparatus into said section of casing or lining, the mandrel having a longitudinal axis; a sliding assembly mounted on the mandrel; at least one gripper (22,122) for gripping onto an inner wall of the section of casing or lining upon insertion therein, the gripper being coupled to the sliding assembly; the sliding assembly (18,118) being operable for moving the gripper between a first position in which the gripper is arranged to grip onto the inner wall of the section of casing or lining in at least one gripping region of the section of casing or lining and a second position in which the gripper is held away from the inner wall; and characterised in that: the apparatus further comprises: a switcher (40, 140) which, when advanced into the section of casing or lining, locks the sliding assembly to the mandrel with the gripper in the second position; and, when the apparatus is pulled upward out of the section of casing or lining and the switcher exits the end of the section of casing or lining, automatically allows engagement of the section of casing or lining by the gripper in the first position; and at least one locking member configured to lock the sliding assembly with respect to the mandrel when the gripper is held away from the inner wall in the second position and the locking member is activated to lock by the relative axial movement between the sliding assembly and the mandrel. a tubular mandrel (12,112) arranged to be connected in a tubular string for inserting the apparatus into said section of casing or lining, the mandrel having a longitudinal axis; a sliding assembly mounted on the mandrel; at least one gripper (22,122) for gripping onto an inner wall of the section of casing or lining upon insertion therein, the gripper being coupled to the sliding assembly; the sliding assembly (18,118) being operable for moving the gripper between a first position in which the gripper is arranged to grip onto the inner wall of the section of casing or lining in at least one gripping region of the section of casing or lining and a second position in which the gripper is held away from the inner wall; and characterised in that: the apparatus further comprises: a switcher (40, 140) which, when advanced into the section of casing or lining, locks the sliding assembly to the mandrel with the gripper in the second position; and, when the apparatus is pulled upward out of the section of casing or lining and the switcher exits the end of the section of casing or lining, automatically allows engagement of the section of casing or lining by the gripper in the first position; and at least one locking member configured to lock the sliding assembly with respect to the mandrel when the gripper is held away from the inner wall in the second position and the locking member is activated to lock by the relative axial movement between the sliding assembly and the mandrel. a switcher (40, 140) which, when advanced into the section of casing or lining, locks the sliding assembly to the mandrel with the gripper in the second position; and, when the apparatus is pulled upward out of the section of casing or lining and the switcher exits the end of the section of casing or lining, automatically allows engagement of the section of casing or lining by the gripper in the first position; and at least one locking member configured to lock the sliding assembly with respect to the mandrel when the gripper is held away from the inner wall in the second position and the locking member is activated to lock by the relative axial movement between the sliding assembly and the mandrel.