To characterize optimal mean-square morphological filters, it is first necessary to interpret morphological operations in a functional manner appropriate to the theory of statistical estimation. The present paper takes such an approach in the case of digital N-observation grayscale filters, these being defined via the Matheron representation. Having obtained the optimality criterion, we are lead to the characterization of a minimal search space, the nodes of the space being potential erosion structuring elements. More precisely, there exists a set of structuring elements which will always contain elements forming the basis for an optimal MS filter. Moreover, the set, called the fundamental set, is minimal, in the sense that no element can be deleted from it without possibly yielding a set not containing the optimal structuring element for a single-erosion filter.