prefix of reversal, deprivation, or removal (as in unhand, undo, unbutton), Old English on-, un-, from Proto-Germanic *andi- (source also of Old Saxon ant-, Old Norse and-, Dutch ont-, Old High German ant-, German ent-, Gothic and- "against"), from PIE *anti "facing opposite, near, in front of, before, against" (from PIE root *ant- "front, forehead," with derivatives meaning "in front of, before").
More or less confused with un- (1) through similarity in the notions of "negation" and "reversal;" an adjective such as unlocked might represent "not locked" (un- (1)) or the past tense of unlock (un- (2)).
c. 1300, "to fasten with a lock, shut or confine with a lock." The sense is narrowed from that of Old English lucan "to lock, to close" (class II strong verb; past tense leac, past participle locen), from the same verbal root that yielded lock (n.1). The form is from the noun (perhaps reinforced by Old Norse loka); the old original strong verb survived as dialectal louk, and the strong past participle locken lingered a while, as in Middle English loken love "hidden love, clandestine love" (early 14c.).
The Old English verb is cognate with Old Frisian luka "to close," Old Saxon lukan, Old High German luhhan, Old Norse luka, Gothic galukan. Meaning "to fasten parts together" is from late 14c., originally of armor; of persons, "to embrace closely," from mid-14c. Related: Locked; locking. Locked "securely established" is from early 15c. To lock (someone) in "shut in a place" is from c. 1400. Slang lock horns "fight" is from 1839.