A cooling system for an electrical motor or generator includes a first cooling loop, a second cooling loop, and a heat exchange system. The first cooling loop may extract heat from an iron stack and winding of the electrical motor or generator. The second cooling loop may extract heat from end turns of the stator winding, the rotor, and the bearings independently from and simultaneously to the first cooling loop. At least the first cooling loop may pass through the heat exchange system. A liquid coolant may circulate in the first cooling loop and a compressed gas, such as compressed air or compressed refrigerant in vapor form, may circulate in the second cooling loop. The cooling system and method for an electrical motor or generator may be suitable for, but not limited to, applications in the aircraft and aerospace industries, such as driving a cabin air compressor of an aircraft.