The redox cofactor F420 protects mycobacteria from diverse antimicrobial compounds and mediates a reductive detoxification system.