A train was moving slowly, with black smoke billowing from its locomotive.