Marsh gas is primarily methane (CH4), which forms in wetlands, swamps, and marshes through the anaerobic decomposition of organic matter by methanogenic bacteria. It bubbles up through the water and can be ignited, giving it the name 'will-o'-the-wisp' in folklore.