1660s, "the structure of a machine, engine, or other contrivance for controlling or utilizing natural forces," from Modern Latin mechanismus, from Greek mēkhanē "machine, instrument, device" (see machine (n.)). Sense of "a mechanical contrivance or agency of any kind" is from 1670s.
c. 1300, "action of guarding or shielding from attack or injury; act of defending by fighting; a fortified place of refuge," from Old French defense, from Latin defensus, past participle of defendere "ward off, protect" (see defend). It also arrived (without the final -e) from Old French defens, from Latin defensum "thing protected or forbidden," neuter past participle of defendere.
Middle English defens was assimilated into defense, but not before it inspired the alternative spelling defence, via the same tendency that produced hence (hennis), pence (penies), dunce (Duns). Webster made the -se form standard in U.S., but British has preferred defence, and compare fence (n.).
Meaning "a speech or writing intended to repel or disprove a charge or accusation" is from late 14c., as is the sense of "method adopted by one against whom a lawsuit has been brought." Meaning "science of defense against attack" (in fencing, boxing, etc.) is from c. 1600. Used by 1935 as a euphemism for "national military resources," but the notion (non-euphemistic) was in Middle English: man of defense "warrior," ship of defense "warship." Defenses "natural weapons of an animal" is by 1889. Defense mechanism in psychology is from 1913.
c. 1400, "serving to defend, proper for defense; of the nature of defense," from Old French defensif (14c., Modern French défensif) and directly from Medieval Latin defensivus, from defens-, past participle stem of Latin defendere (see defend). Of persons, "alert to reject criticism," from 1919. Related: Defensively; defensiveness.
As a noun, "that which defends or serves for defense," c. 1400, originally of medicines. Meaning "posture or attitude of defense" is from c. 1600.