quality:correction, structural:reformatting
Premodern history

Locks have been in use for over 6000 years, with one early example discovered in the ruins of Nineveh, the capital of ancient Assyria. Locks such as this were developed into the Egyptian wooden pin lock, which consisted of a bolt, door fixture or attachment, and key. When the key was inserted, pins within the fixture were lifted out of drilled holes within the bolt, allowing it to move. When the key was removed, the pins fell part-way into the bolt, preventing movement.

The warded lock was also present from antiquity and remains the most recognizable lock and key design in the Western world. The first all-metal locks appeared between the years 870 and 900, and are attributed to English craftsmen. It is also said that the key was invented by Theodorus of Samos in the 6th century BC.

'The Romans invented metal locks and keys and the system of security provided by wards.'

Affluent Romans often kept their valuables in secure locked boxes within their households, and wore the keys as rings on their fingers. The practice had two benefits: It kept the key handy at all times, while signaling that the wearer was wealthy and important enough to have money and jewellery worth securing.

A special type of lock, dating back to the 17th-18th century, although potentially older as similar locks date back to the 14th century, can be found in the Beguinage of the Belgian city Lier. These locks are most likely Gothic locks, that were decorated with foliage, often in a V-shape surrounding the keyhole. They are often called drunk man's lock, as these locks were, according to certain sources, designed in such a way a person can still find the keyhole in the dark, although this might not be the case as the ornaments might have been purely aesthetic. In more recent times similar locks have been designed.