A lanthanide-rich kilonova in the aftermath of a long gamma-ray burst.