Helicobacter pylori infection increases gastric acid secretion in patients with duodenal ulcers but diminishes acid output in patients with gastric cancer and their relatives. Investigation of the basic mechanisms may show how H. pylori causes different diseases in different persons. Infection of the gastric antrum increases gastrin release. Certain cytokines released in H. pylori gastritis, such as tumor necrosis factor alpha and specific products of H. pylori, such as ammonia, release gastrin from G cells and might be responsible. The infection also diminishes mucosal expression of somatostatin. Exposure of canine D cells to tumor necrosis factor alpha in vitro reproduces this effect. These changes in gastrin and somatostatin increase acid secretion and lead to duodenal ulceration. But the acid response depends on the state of the gastric corpus mucosa. The net effect of corpus gastritis is to decrease acid secretion. Specific products of H. pylori inhibit parietal cells. Also, interleukin 1 beta, which is overexpressed in H. pylori gastritis, inhibits both parietal cells and histamine release from enterochromaffin-like cells. H. pylori also promotes gastric atrophy, leading to loss of parietal cells. Factors such as a high-salt diet and a lack of dietary antioxidants, which also increase corpus gastritis and atrophy, may protect against duodenal ulcers by decreasing acid output. However, the resulting increase of intragastric pH may predispose to gastric cancer by allowing other bacteria to persist and produce carcinogens in the stomach.