This paper presents the exergy analysis and optimisation of a ground or water source heat pump system for housing applications with the purpose of best performance and maximum environmental exergy potential use. The present analysis also offers the opportunity of defining a new objective function for the optimisation of the use of exergy sources: 'In any system powered by an external exergy source optimisation is achieved when the exergy flux to the environment is minimum under the existing constraints”. This corresponds to utilizing the available exergy to overcome the total irreversibilities of such a system only. The environmental exergy utilisation and the exergy output to the environment are analysed in relation with this objective