We prove that, under suitable restrictions, an idempotent monad t defined on a full subcategory A of a category C can be extended to an idempotent monad T on C in a universal (terminal) way. Our result applies in particular to the case when t is P-localization of nilpotent groups (where P denotes a set of primes) and C is the category of all groups. The corresponding monad T on C is, in a certain precise sense, the best idempotent approximation to the usualZ P -completion of groups; it turns out to be a strict epimorphic image of Bousfield'sHZ P -localization.