Garlic and onions can put a crimp in your social life, but they also could provide unexpected protection against cancer, according to a study published by the National Cancer Institute.

The study compared foods eaten by stomach cancer victims with the diet of healthy people in Linqu, China. Researchers found that the strong-smelling vegetables "can significantly reduce the risk of stomach cancer."Published this week in the Journal of the National Cancer Institute, the study says researchers used questionnaires to compare the dietary habits of 685 patients with stomach cancer with those of 1,131 other people, matched by age, gender, occupation and education, who had no diagnosed cancer.

People in the control, or cancer-free, group each year consumed at least 25 and sometimes more than 50 pounds of allium vegetables, a genus that includes onions, garlic, leeks, chives, ramps and scallions.

The cancer patients generally ate less than 25 pounds of the vegetables.

The study also found that the risk of stomach cancer declined as the habitual consumption of such vegetables increased. In other words, the more onions and garlic you eat over a lifetime, the less your chances of stomach cancer.

"Persons in Linqu tended to be exposed to mild doses of allium vegetables over long periods, likely beginning in childhood," the study said. "Our study suggests that all or part of such exposure has resulted in a reduction in stomach cancer risk starting at an early age and continuing throughout life."

The anti-cancer effects of onion-like root vegetables have been suggested in studies dating back to the 1950s. A 1979 study, for instance, found a reduced amount of stomach cancer among residents of a Georgia county famous for growing vidalia onions. A study in Greece showed that gastric cancer patients usually ate fewer fresh vegetables, including onions, than those who were cancer-free.

"Several experimental studies have suggested that compounds in allium vegetables can protect against cancer in laboratory animals," the NCI Journal study said. It said a variety of studies have shown that chemical compounds extracted from onions and garlic tend to reduce, alter or prevent cancer in laboratory rats, mice and hamsters.

But the study said the precise anti-cancer element in allium vegetables has not been pinpointed.