Apparatus for fastening a communication and/or automation device to a top-hat rail, comprising - a main body (100, 200) which can be connected to the communication and/or automation device and has a first side, which faces the communication and/or automation device, and a second side, which is averted from the communication and/or automation device, - at least one stationary first fixing element (101, 201) on the second side of the main body (100, 200), which first fixing element has a groove or an undercut which can be brought into engagement with a bent end of a first limb of a top-hat rail, - at least one second fixing element (102, 202) on the second side of the main body (100, 200), which second fixing element can be displaced in the direction of the first fixing element and is pretensioned in relation to the first fixing element (101, 201) by means of a spring mechanism and has a groove or an undercut (120, 220) at a first end, which groove or undercut can be brought into engagement with a bent end of a second limb of the top-hat rail, wherein the first fixing element (101, 201) and the second fixing element (102, 202), in a locking position of the second fixing element (102, 202), engage in a substantially interlocking manner around the bent ends of the limbs (311, 312) of the top-hat rail, and wherein the second fixing element (102, 202) can be displaced between the locking position and a mounting position, - a delimiting element (130, 230) which is arranged at a second end of the second fixing element (102, 202) and extends transversely in relation to a displacement direction of the second fixing element (102, 202), characterized in that - the delimiting element (130, 230) has two support faces (131-132, 231-232) which are inclined oppositely in relation to one another, - a threaded bore is provided through an end section of the main element (100, 200), which end section adjoins the second end of the second fixing element (102, 202), - a fastening screw (104, 204) is screwed into the threaded bore from the first side of the main element (100, 200), wherein a free end of the fastening screw (104, 204) can be clamped against a first support face (131, 231) of the delimiting element (130, 230) in the mounting position of the second fixing element (102, 202) and can be clamped against a second support face (132, 232) of the delimiting element in the locking position of the second fixing element (102, 202). - a main body (100, 200) which can be connected to the communication and/or automation device and has a first side, which faces the communication and/or automation device, and a second side, which is averted from the communication and/or automation device, - at least one stationary first fixing element (101, 201) on the second side of the main body (100, 200), which first fixing element has a groove or an undercut which can be brought into engagement with a bent end of a first limb of a top-hat rail, - at least one second fixing element (102, 202) on the second side of the main body (100, 200), which second fixing element can be displaced in the direction of the first fixing element and is pretensioned in relation to the first fixing element (101, 201) by means of a spring mechanism and has a groove or an undercut (120, 220) at a first end, which groove or undercut can be brought into engagement with a bent end of a second limb of the top-hat rail, wherein the first fixing element (101, 201) and the second fixing element (102, 202), in a locking position of the second fixing element (102, 202), engage in a substantially interlocking manner around the bent ends of the limbs (311, 312) of the top-hat rail, and wherein the second fixing element (102, 202) can be displaced between the locking position and a mounting position, - a delimiting element (130, 230) which is arranged at a second end of the second fixing element (102, 202) and extends transversely in relation to a displacement direction of the second fixing element (102, 202), - the delimiting element (130, 230) has two support faces (131-132, 231-232) which are inclined oppositely in relation to one another, - a threaded bore is provided through an end section of the main element (100, 200), which end section adjoins the second end of the second fixing element (102, 202), - a fastening screw (104, 204) is screwed into the threaded bore from the first side of the main element (100, 200), wherein a free end of the fastening screw (104, 204) can be clamped against a first support face (131, 231) of the delimiting element (130, 230) in the mounting position of the second fixing element (102, 202) and can be clamped against a second support face (132, 232) of the delimiting element in the locking position of the second fixing element (102, 202).