An apparatus for producing electric power, the apparatus being formed as a free-piston combustion engine, the apparatus including a housing at an end of which a portion is formed, housing a combustion chamber, wherein a piston is housed within said portion of said housing and delimits said combustion chamber, said piston being housed free within said portion of said housing and being arranged to reciprocate therein, said piston being connected to an end of a rod, the said rod has fastened thereto one or more support means carrying sets of movable magnetic means (25a, 27a), facing sets of stationary magnetic means (27a, 25a) for producing electric power when the movable magnetic means (25a, 27a) are moved with respect to the stationary magnetic means (27a, 25a), wherein the piston comprises a piston valve being configured for blocking or unblocking an piston opening in the piston in order to provide air to the combustion chamber and/or in order to conduct exhaust gas from the combustion chamber, wherein the apparatus comprises a second combustion chamber being formed at a second end of said housing at which a second substantially cylindrical portion is formed and wherein a second piston is housed within said second portion of said housing and delimits said second combustion chamber, said second piston being housed free within said second portion of said housing and being arranged to reciprocate therein, said second piston being connected to an end of a second rod, the said second rod has fastened thereto one or more support means carrying second sets of movable magnetic means (25b, 27b), facing second sets of stationary magnetic means (27b, 25b) for producing electric power when the second movable magnetic means (25b, 27b) are moved with respect to the second set of stationary magnetic means (27b, 25b), the second piston comprising a second piston valve being configured for blocking or unblocking a second piston opening in the second piston in order to provide air to the second combustion chamber and/or in order to conduct exhaust gas from the second combustion chamber and characterized by a third piston being connected at the rod at an opposed end to said piston and said second rod carrying a fourth piston at the opposed end to the second piston, said third piston and said fourth piston defining, together with the walls of said housing, a third combustion chamber formed in an intermediate portion of said housing, and wherein said third piston comprises a third piston valve being configured for blocking or unblocking a third piston opening in the third piston in order to provide air to the third combustion chamber and/or in order to conduct exhaust gas from the third combustion chamber and/or the fourth piston comprises a fourth piston valve being configured for blocking or unblocking a fourth piston opening in the fourth piston in order to provide air to the third combustion chamber and/or in order to conduct exhaust gas from the third combustion chamber. the piston comprises a piston valve being configured for blocking or unblocking an piston opening in the piston in order to provide air to the combustion chamber and/or in order to conduct exhaust gas from the combustion chamber, wherein the apparatus comprises a second combustion chamber being formed at a second end of said housing at which a second substantially cylindrical portion is formed and wherein a second piston is housed within said second portion of said housing and delimits said second combustion chamber, said second piston being housed free within said second portion of said housing and being arranged to reciprocate therein, said second piston being connected to an end of a second rod, the said second rod has fastened thereto one or more support means carrying second sets of movable magnetic means (25b, 27b), facing second sets of stationary magnetic means (27b, 25b) for producing electric power when the second movable magnetic means (25b, 27b) are moved with respect to the second set of stationary magnetic means (27b, 25b), the second piston comprising a second piston valve being configured for blocking or unblocking a second piston opening in the second piston in order to provide air to the second combustion chamber and/or in order to conduct exhaust gas from the second combustion chamber and characterized by a third piston being connected at the rod at an opposed end to said piston and said second rod carrying a fourth piston at the opposed end to the second piston, said third piston and said fourth piston defining, together with the walls of said housing, a third combustion chamber formed in an intermediate portion of said housing, and wherein said third piston comprises a third piston valve being configured for blocking or unblocking a third piston opening in the third piston in order to provide air to the third combustion chamber and/or in order to conduct exhaust gas from the third combustion chamber and/or the fourth piston comprises a fourth piston valve being configured for blocking or unblocking a fourth piston opening in the fourth piston in order to provide air to the third combustion chamber and/or in order to conduct exhaust gas from the third combustion chamber.