Infected wounds pose a major mortality risk in animals. Injuries are particularly common in the ant Megaponera analis which raids pugnacious prey. Here we show that M. analis can determine when wounds are infected and treat them specifically. By applying a variety of antimicrobial compounds and proteins secreted from the metapleural gland to infected wounds workers reduce the mortality of infected individuals by 90%. Chemical analyses showed that wound infection is associated with specific changes in the cuticular hydrocarbon profile thereby likely allowing nestmates to diagnose the infection state of injured individuals and apply the appropriate antimicrobial treatment. This study demonstrates that the targeted use of antimicrobials to treat infected wounds, previously thought to be a uniquely human behavior, has evolved in insect societies as well.