The influence of hardness and phosphorus grain-boundary segregation (PGBS) on the ductile-to-brittle transition temperature (DBTT) of a 17-4 PH martensitic steel was studied. Thermal treatments including long-time aging at low temperature were made to get different hardness levels and different PGBS amounts. A synergetic effect between PGBS and hardness on the DBTT of the steel is evidenced; in other words, the DBTT shift due to PGBS increases with hardness. If hardness is low enough, PGBS can even have no effect on the DBTT. A tentative interpretation of this synergetic effect is proposed, based on the assumption that the detrimental effect of PGBS on the grain-boundary cohesion increases with temperature.