A bayonet is a knife, dagger, sword, or spike-shaped weapon designed to fit on the end of the muzzle of a rifle, musket or similar firearm, allowing it to be used as a spear-like weapon. From the 17th century to World War I, it was considered a primary weapon for infantry attacks. Today, it is considered an ancillary weapon or a weapon of last resort.