The reticulation of an algebra A is a bounded distributive lattice L(A) whose prime spectrum of filters or ideals is homeomorphic to the prime spectrum of congruences of A, endowed with the Stone topologies. We have obtained a construction for the reticulation of any algebra A from a semi-degenerate congruencemodular variety C in the case when the commutator of A, applied to compact congruences of A, produces compact congruences, in particular when C has principal commutators; furthermore, it turns out that weaker conditions than the fact that A belongs to a congruence-modular variety are sufficient for A to have a reticulation. This construction generalizes the reticulation of a commutative unitary ring, as well as that of a residuated lattice, which in turn generalizes the reticulation of a BL-algebra and that of an MV-algebra. The purpose of constructing the reticulation for the algebras from C is that of transferring algebraic and topological properties between the variety of bounded distributive lattices and C, and a reticulation functor is particularily useful for this transfer. We have defined and studied a reticulation functor for our construction of the reticulation in this context of universal algebra.