Consumer advocates say the need is urgent. Just this week, federal health authorities said an outbreak of salmonella, most likely caused by cucumbers imported from Mexico, had sickened 341 people in 30 states. Seventy of those people were hospitalized and two have died, one in Texas and one in California. Also this year, Blue Bell Creameries, an ice cream producer with plants in Texas, Oklahoma and Alabama, had to recall all its products after 10 people became ill with listeria from eating them. Three of those people died.

The new rules are related to the processing of foods like peanut butter and ice cream. A separate rule on fresh produce is not expected to become final until later this year. Today, nearly half of fresh fruits and one-fifth of vegetables in the United States are imported, a relatively recent shift that has created new difficulties for monitoring food safety.

The new rules require food manufacturers to put in place written food safety plans that detail points in the manufacturing process that could be risky and steps they are taking to minimize that risk.

Michael R. Taylor, deputy commissioner for foods and veterinary medicine at the F.D.A., said the law’s mandate was to “transform the whole food safety system,” a task that was sweeping and required months of negotiations with a vast array of groups like state and foreign governments, farms, food manufacturers and food importers. That the first rules became final in less than five years was a significant accomplishment, he said.

He said that some large food producers already had sophisticated systems in place, for example, regular swabs of floors, drains and walls inside facilities to check for contaminants, and that the new rules had to be flexible to allow for pre-existing safety systems that were working.