A 58-year-old male presents with a 3-month history of burning epigastric pain occurring 1-2 hours after meals. He has a 30-year smoking history and drinks alcohol regularly. Endoscopy confirms a gastric ulcer. What is the primary mechanism by which NSAIDs contribute to gastric ulcer formation?