Accurate measurement of the lifetime of the neutron (which is unstable to beta decay) is important for understanding the weak nuclear force and the creation of matter during the Big Bang. Previous measurements of the neutron lifetime have mainly been limited by certain systematic errors; however, these could in principle be avoided by performing measurements on neutrons stored in a magnetic trap. Neutral and charged particle traps are widely used tool for studying both composite and elementary particles, because they allow long interaction times and isolation from perturbing environments. Here we report the magnetic trapping of neutrons. The trapping region is filled with superfluid 4-He, which is used to load neutrons into the trap and as a scintillator to detect their decay. Neutrons have a lifetime in the trap of 750 +330/-200 seconds, mainly limited by their beta decay rather than trap losses. Our experiment verifies theoretical predictions regarding the loading process and magnetic trapping of neutrons. Further refinement of this method should lead to improved precision in the neutron lifetime measurement.