We present a new model for gamma-ray bursts to explain their isotropic but inhomogeneous space distribution. We propose that the Magellanic Clouds are the source of a special population of gamma-ray-bursting pulsars which are easily ejected from the Clouds and lead to a halo distribution which is homogeneous within a radius of approximately 50 kpc and falls off rapidly beyond. One way of forming pulsars with the required properties is through spin-up in massive, very luminous X-ray binaries, of which there are an exceptional number in the Clouds. If accretion in the spin-up phase causes magnetic field decay then the Clouds disperse rapidly spinning, old pulsars throughout the Galactic halo. Their sky distribution is very isotropic, but also shows some small anisotropies, in particular in the direction of the Clouds and in their orbital plane. We estimate that these anisotropies should become discernible when a few thousand bursts have been detected, and so should allow verification or refutation of the model.