A method for controlling a thermal and electrical power plant for setting in motion at least one rotary member (2, 3) of a rotorcraft, the power plant comprising a thermal system and an electrical system for setting in motion a power transmission system connected to the at least one rotary member (2, 3), the thermal system having at least one heat engine and the electrical system being provided with at least one electric machine, the electrical system having an electrical energy source electrically connected to the at least one electric machine, wherein the method comprises selecting (STPSELECT), with a selector of an operating mode chosen from several operating modes, the method having a hybridization phase (Phashyb) comprising the following steps: - comparing, with a controller, a current density altitude (Zt) and a threshold density altitude (Zs); - controlling, with the controller, the at least one electric machine, depending on the chosen operating mode as well as the comparing and a necessary power (WNEC) to be supplied to the power transmission system, the rotary member comprising a rotary wing, and the method comprising: - determining a failure of the thermal system rendering it inoperative, - determining a speed of rotation (Nr) of the rotary wing, - commanding (STPROT) with the controller of the operation in motor mode of the at least one electric machine in the presence of one failure and of one speed of rotation (Nr) greater than zero, - comparing of the speed of rotation (Nr) with a stored autorotation speed (Nrautorot), - commanding with the controller of the at least one electric machine to deliver maximum auxiliary power (Pwemax) in motor mode if the speed of rotation (Nr) is lower than the autorotation speed (Nrautorot), and - commanding with the controller of the at least one electric machine to deliver in motor mode a power (Pwelow) that is lower than the maximum auxiliary power (Pwemax) if the speed of rotation (Nr) is greater than or equal to the autorotation speed (Nrautorot). wherein the method comprises selecting (STPSELECT), with a selector of an operating mode chosen from several operating modes, the method having a hybridization phase (Phashyb) comprising the following steps: - comparing, with a controller, a current density altitude (Zt) and a threshold density altitude (Zs); - controlling, with the controller, the at least one electric machine, depending on the chosen operating mode as well as the comparing and a necessary power (WNEC) to be supplied to the power transmission system, the rotary member comprising a rotary wing, and the method comprising: - determining a failure of the thermal system rendering it inoperative, - determining a speed of rotation (Nr) of the rotary wing, - commanding (STPROT) with the controller of the operation in motor mode of the at least one electric machine in the presence of one failure and of one speed of rotation (Nr) greater than zero, - comparing of the speed of rotation (Nr) with a stored autorotation speed (Nrautorot), - commanding with the controller of the at least one electric machine to deliver maximum auxiliary power (Pwemax) in motor mode if the speed of rotation (Nr) is lower than the autorotation speed (Nrautorot), and - commanding with the controller of the at least one electric machine to deliver in motor mode a power (Pwelow) that is lower than the maximum auxiliary power (Pwemax) if the speed of rotation (Nr) is greater than or equal to the autorotation speed (Nrautorot). - comparing, with a controller, a current density altitude (Zt) and a threshold density altitude (Zs); - controlling, with the controller, the at least one electric machine, depending on the chosen operating mode as well as the comparing and a necessary power (WNEC) to be supplied to the power transmission system, the rotary member comprising a rotary wing, and the method comprising: - determining a failure of the thermal system rendering it inoperative, - determining a speed of rotation (Nr) of the rotary wing, - commanding (STPROT) with the controller of the operation in motor mode of the at least one electric machine in the presence of one failure and of one speed of rotation (Nr) greater than zero, - comparing of the speed of rotation (Nr) with a stored autorotation speed (Nrautorot), - commanding with the controller of the at least one electric machine to deliver maximum auxiliary power (Pwemax) in motor mode if the speed of rotation (Nr) is lower than the autorotation speed (Nrautorot), and - commanding with the controller of the at least one electric machine to deliver in motor mode a power (Pwelow) that is lower than the maximum auxiliary power (Pwemax) if the speed of rotation (Nr) is greater than or equal to the autorotation speed (Nrautorot). - determining a failure of the thermal system rendering it inoperative, - determining a speed of rotation (Nr) of the rotary wing, - commanding (STPROT) with the controller of the operation in motor mode of the at least one electric machine in the presence of one failure and of one speed of rotation (Nr) greater than zero, - comparing of the speed of rotation (Nr) with a stored autorotation speed (Nrautorot), - commanding with the controller of the at least one electric machine to deliver maximum auxiliary power (Pwemax) in motor mode if the speed of rotation (Nr) is lower than the autorotation speed (Nrautorot), and - commanding with the controller of the at least one electric machine to deliver in motor mode a power (Pwelow) that is lower than the maximum auxiliary power (Pwemax) if the speed of rotation (Nr) is greater than or equal to the autorotation speed (Nrautorot).