Measurement of leading neutron energy and transverse momentum distributions in deep inelastic scattering and photoproduction with ZEUS at HERA The production of energetic neutrons in ep collisions was studied with the ZEUS detector at HERA. The neutron energy and transverse energy was measured with a forward neutron calorimeter and tracker. The inclusive deep inelastic scattering (DIS) data used correspond to an integrated luminosity of 40 pb-1 and the photoproduction data to 6pb-1. The neutron yield in photoproduction is suppressed relative to DIS for the lower neutron energies and the neutrons have a steeper pT2 distribution, consistent with the expectation from absorption models. The distributions are compared to HERA measurements of leading protons. The neutron energy and transverse-momentum distributions in DIS are also compared to Monte Carlo simulations and to the predictions of particle exchange models. Models with pion exchange incorporating absorption and additional secondary meson exchanges give a good description of the data.