Castles first appeared in Europe about 1,000 years ago. They were built by powerful nobles (lords, princes, dukes, etc.) who wanted to control their lands. Castles helped the nobles gain this control by serving as both offensive and defensive structures. Offensively, castles provided a base from which to launch raids. Defensively, they provided protection from enemies. Nobles continued to use castles until the 16th century. Then, with the invention of gunpowder, cannon fire eventually became strong enough to break through castle walls. After more than 600 years, the age of castles came to an end.