NOVELTY - The method comprises supplying magnesium and/or magnesium alloy to a combustion chamber (2), oxidizing the magnesium in the combustion chamber, supplying water to the combustion chamber, converting the magnesium and water into hydrogen formation under the combustion chamber, supplying the hydrogen to a closed fuel cell (3), and electrochemically converting the hydrogen into electricity in the fuel cell. An oxidation agent such as air and/or oxygen is supplied to the combustion chamber. The temperature in the combustion chamber is controlled by the addition of the oxidation agent.    USE - Method for converting chemical energy into thermal and electrical energy.    ADVANTAGE - The method is capable of easily, efficiently and economically converting the chemical energy into thermal and electrical energy in a reliable manner.    DETAILED DESCRIPTION - The method comprises supplying magnesium and/or magnesium alloy to a combustion chamber (2), oxidizing the magnesium in the combustion chamber, supplying water to the combustion chamber, converting the magnesium and water into hydrogen formation under the combustion chamber, supplying the hydrogen to a closed fuel cell (3), and electrochemically converting the hydrogen into electricity in the fuel cell. An oxidation agent such as air and/or oxygen is supplied to the combustion chamber. The temperature in the combustion chamber is controlled by the addition of the oxidation agent. The oxidation agent is supplied simultaneously with the water to the combustion chamber. The magnesium is combusted in the combustion chamber by light emission at 500 degrees C. The water is converted through the magnesium under hydrogen release at above 2000 degrees C. The heat is indirectly exchanged between the fuel cell and the combustion chamber by an indirect heat exchanger. The fuel cell and/or the fuel cells are cooled for providing useful heat over a cooling medium such as water. The magnesium and/or magnesium alloy are heated before supplying to the combustion chamber. The water is heated and/or evaporated before supplying to the combustion chamber. An INDEPENDENT CLAIM is included for a device for converting chemical energy into thermal and electrical energy.    DESCRIPTION OF DRAWING(S) - The diagram shows a schematic representation of a device for converting chemical energy into thermal and electrical energy.    Device (1)    Combustion chamber (2)    Fuel cell (3)    Feeding device (4)    Conveying screw. (7)