A gas turbine engine for an aircraft, comprising: a high-pressure (HP) spool comprising an HP compressor and a first electric machine driven by an HP turbine ; a low-pressure (LP) spool comprising an LP compressor and a second electric machine driven by an LP turbine ; a combustor ; and an engine controller ; characterized in that the gas turbine engine further comprises an electrical energy storage unit and in that the engine controller is configured to: in response to receipt of a request for an increased electrical power supply by the engine (dP D ) within a requested timeframe (dt), evaluate a current HP compressor surge margin (dR H /R H ) and a current LP compressor surge margin (dR L /R L ) based on the operating points thereof; in response to evaluating that one or more of the HP compressor and the LP compressor has insufficient surge margin to facilitate a change of electrical power supply at a requested rate (dP D /dt), meet the requested electrical power demand using the electrical energy storage unit whilst increasing fuel flow to the combustor to accelerate the engine , and gradually increase the amount of electrical power supplied from one or more of the first and second electric machine whilst the engine accelerates. a high-pressure (HP) spool comprising an HP compressor and a first electric machine driven by an HP turbine ; a low-pressure (LP) spool comprising an LP compressor and a second electric machine driven by an LP turbine ; a combustor ; and an engine controller ; characterized in that the gas turbine engine further comprises an electrical energy storage unit and in that the engine controller is configured to: in response to receipt of a request for an increased electrical power supply by the engine (dP D ) within a requested timeframe (dt), evaluate a current HP compressor surge margin (dR H /R H ) and a current LP compressor surge margin (dR L /R L ) based on the operating points thereof; in response to evaluating that one or more of the HP compressor and the LP compressor has insufficient surge margin to facilitate a change of electrical power supply at a requested rate (dP D /dt), meet the requested electrical power demand using the electrical energy storage unit whilst increasing fuel flow to the combustor to accelerate the engine , and gradually increase the amount of electrical power supplied from one or more of the first and second electric machine whilst the engine accelerates. in response to receipt of a request for an increased electrical power supply by the engine (dP D ) within a requested timeframe (dt), evaluate a current HP compressor surge margin (dR H /R H ) and a current LP compressor surge margin (dR L /R L ) based on the operating points thereof; in response to evaluating that one or more of the HP compressor and the LP compressor has insufficient surge margin to facilitate a change of electrical power supply at a requested rate (dP D /dt), meet the requested electrical power demand using the electrical energy storage unit whilst increasing fuel flow to the combustor to accelerate the engine , and gradually increase the amount of electrical power supplied from one or more of the first and second electric machine whilst the engine accelerates. <EOS>