A matrix A∈Mn(R) with coefficients in any ring R is a quasi-permutation matrix if each row and each column has at most one nonzero element. It is shown that a singular quasi-permutation matrix with coefficients in a domain is a product of idempotent matrices. As an application, we prove that a nonnegative singular matrix having nonnegative von Neumann inverse (also known as generalized inverse) is a product of nonnegative idempotent matrices.