The storage of ultracold neutrons (UCN) in a combined magnetic, gravitational, and material trap is described. Wall materials investigated were diamondlike carbon (DLC) coatings on solid and flexible foil substrates as well as beryllium coatings on solid substrates. The loss coefficient per wall collision, η, and the depolarization probability β were measured simultaneously as a function of temperature (from 70 to 400 K) and energy (from 30 to 80 neV). The results at 70 K are η = (0.7 ± 0.1) × 10 −4 , β = (15.4 ± 1.0) × 10 −6 for DLC on polyethyleneterephtalate (PET) foil and η = (1.7 ± 0.1) × 10 −4 , β = (0.7 ± 0.3) × 10 −6 for DLC on aluminum foil. At room temperature the loss coefficients are larger by a factor of about 2 whereas the depolarization probabilities are found to be independent of temperature. The corresponding values for Be at room temperature are η ∼ 5 × 10 −4 , β ∼ 10 × 10 −6 . The DLC results for β and for the temperature-dependent part of the loss coefficient, η T , are interpreted in terms of incoherent scattering by hydrogen. The hydrogen admixture was measured independently by elastic recoil detection analysis to be about 1 × 10 16 atoms/cm 2 . The data do not support the hypothesis of hydrogen being chemically bound within the top layers of the DLC. Using two different models with a thin waterlike film on top of the substrate we obtain consistency between the temperature-dependent loss contribution and the measured hydrogen contamination.