BERLIN — Something was very wrong at the valve factory. A 23-year-old trainee at ARI-Armaturen, a middle-sized manufacturer in the German industrial town of Schloss Holte-Stukenbrock, fell into a persistent vegetative state. He was found to have ingested highly toxic mercury, but investigators could not work out where it had come from.

Another employee on the same shift went to doctors at least five times with mystery symptoms, and was eventually found to have severe kidney damage.

The truth emerged, according to media reports, only when a third employee, Klaus Radke, noticed a brownish substance in the ham-and-cheese sandwiches he brought from home. After it had happened several times, he went to the police, and — about 18 months after the young trainee fell into the coma — they asked the company to install a camera in its break room.

A 57-year-old machinist, identified under German privacy laws only as Klaus O., was poisoning his colleagues’ sandwiches. On Thursday, a court in the nearby city of Bielefeld sentenced him to life in prison.