A performance analysis and optimization based on a new thermoecological criterion has been performed for a generalized irreversible Carnot heat engine with losses due to heat transfer across finite temperature differences, heat leak and internal irreversibilities. The ratio of the power produced by the engine to the loss rate of availability, which is named ecological coefficient of performance (ECOP), has been taken as an objective function for the optimization. The maximum of the ecological coefficient of performance function and the corresponding optimal conditions have been derived analytically. The effects of internal irreversibilities, heat leakage and source temperature ratio on the global and optimal performances have been investigated. The results are compared with those of the ecological performance criterion in the literature.