A search for a signal consistent with the type-III seesaw mechanism in events with three or more electrons or muons is presented. The data sample consists of proton-proton collisions at √s=13 TeV collected by the CMS experiment at the LHC in 2016 and corresponds to an integrated luminosity of 35.9 fb−1. Selection criteria based on the number of leptons and the invariant mass of oppositely charged lepton pairs are used to distinguish the signal from the standard model background. The observations are consistent with the expectations from standard model processes. The results are used to place limits on the production of heavy fermions of the type-III seesaw model as a function of the branching ratio to each lepton flavor. In the scenario of equal branching fractions to each lepton flavor, heavy fermions with masses below 840 GeV are excluded. This is the most sensitive probe to date of the type-III seesaw mechanism.