Fred A. Kummerow, a German-born biochemist and lifelong contrarian whose nearly 50 years of advocacy led to a federal government ban on the use of trans-fatty acids in processed foods, a ruling that could prevent tens of thousands of premature deaths a year, died on Wednesday at his home in Urbana, Ill. He was 102.

His family announced his death. He had been a longtime professor at the University of Illinois, Urbana-Champaign.

Artificial trans fats — derived from the hydrogen-treated oils used to give margarine its easy-to-spread texture and prolong the shelf life of crackers, cookies, icing and hundreds of other staples in the American diet — were ruled unsafe by the Food and Drug Administration partly in response to a lawsuit that Professor Kummerow filed against the agency in 2013, two months shy of his 99th birthday. The ban, announced in 2015, goes into effect in 2018.

He had been one of the first scientists to suggest a link between processed foods and heart disease. In the 1950s, while studying lipids at the university, he analyzed diseased arteries from about two dozen people who had died of heart attacks and discovered that the vessels were filled with trans fats.