  Rapidly-spinning magnetars can potentially form by the accretion induced
collapse of a white dwarf or by neutron star mergers if the equation of state
of nuclear density matter is such that two low mass neutron stars can sometimes
form a massive neutron star rather than a black hole. In either case, the newly
born magnetar is an attractive site for producing ultrahigh-energy cosmic rays
(particles with individual energies exceeding $10^{18}\,{\rm eV}$; UHECRs). The
short-period spin and strong magnetic field are able to accelerate particles up
to the appropriate energies, and the composition of material on and around the
magnetar may naturally explain recent inferences of heavy elements in UHECRs.
We explore whether the small amount of natal debris surrounding these magnetars
allows the UHECRs to easily escape. We also investigate the impact on the
UHECRs of the unique environment around the magnetar, which consists of a
bubble of relativistic particles and magnetic field within the debris. Rates
and energetics of UHECRs are consistent with such an origin even though the
rates of events that produce rapidly-spinning magnetars remain very uncertain.
The low ejecta mass also helps limit the high-energy neutrino background
associated with this scenario to be below current IceCube constraints over most
of the magnetar parameter space. A unique prediction is that UHECRs may be
generated in old stellar environments without strong star formation in contrast
to what would be expected for other UHECR scenarios, such as active galactic
nuclei or long gamma-ray bursts.
