Ivermectin is primarily an antiparasitic medication, specifically a macrocyclic lactone, used to treat various parasitic infections by targeting and killing parasites  particularly nematodes and ectoparasites.