A long-duration gamma-ray burst of dynamical origin from the nucleus of an ancient galaxy - Nature Astronomy