An image forming apparatus comprising: an openable and closable member that is arranged to open and close with respect to a main body of the image forming apparatus; a locking member that is arranged to lock the openable and closable member ; an urging member arranged to urge the locking member ; and a solenoid including a plunger , the plunger being arranged to act on the locking member and to urge the locking member in a first direction and a second direction opposite to the first direction, a coil that, when energized, is arranged to move the plunger between a first position in which the locking member is engaged with the openable and closable member and a second position moved from the first position in the second direction, and a magnet that is arranged to exert a magnetic force on the plunger , wherein the following expressions are satisfied: F 2 < M 2 , and F 1 > M 1 , where F1 is a force in the first direction with which the urging member urges the locking member when the plunger is at the first position, F2 is a force in the first direction with which the urging member urges the locking member when the plunger is at the second position, M1 is a force in the second direction acting on the plunger from the magnet when the plunger is at the first position, and M2 is a force in the second direction acting on the plunger from the magnet when the plunger is at the second position; characterised in that the following expressions are satisfied: F 1 < M 1 + E , and F 2 + R > M 2 , where E is a force generated from the coil to move the plunger in the second direction, and R is a force generated from the coil to move the plunger in the first direction. an openable and closable member that is arranged to open and close with respect to a main body of the image forming apparatus; a locking member that is arranged to lock the openable and closable member ; an urging member arranged to urge the locking member ; and a solenoid including a plunger , the plunger being arranged to act on the locking member and to urge the locking member in a first direction and a second direction opposite to the first direction, a coil that, when energized, is arranged to move the plunger between a first position in which the locking member is engaged with the openable and closable member and a second position moved from the first position in the second direction, and a magnet that is arranged to exert a magnetic force on the plunger , wherein the following expressions are satisfied: F 2 < M 2 , and F 1 > M 1 , where F1 is a force in the first direction with which the urging member urges the locking member when the plunger is at the first position, F2 is a force in the first direction with which the urging member urges the locking member when the plunger is at the second position, M1 is a force in the second direction acting on the plunger from the magnet when the plunger is at the first position, and M2 is a force in the second direction acting on the plunger from the magnet when the plunger is at the second position; characterised in that the following expressions are satisfied: F 1 < M 1 + E , and F 2 + R > M 2 , where E is a force generated from the coil to move the plunger in the second direction, and R is a force generated from the coil to move the plunger in the first direction. <EOS>