Mae '''Castell''' (benthyciad o'r fryngaerau niferus, a'r gaerau ledled Ewrop a'r Môr Canoldir. Ceir traddodiad o godi cestyll mewn nifer o wledydd eraill hefyd, e.e. yn Tsieina a Siapan. 

==Datblygiad cestyll yn Ewrop yr Oesoedd Canol==
200px|bawd|[[Castell mwnt a beili Normanaidd (model)]]
thumb|right|200px|Castell Będzin, Gwlad Pwyl
Dros y canrifoedd newidiodd y cestyll o wneuthuriad pren i gestyll cerrig, ac yn ddiweddarach, o fod yn amddiffynfa i fod yn blas neu gartref. Bellach mae nhw wedi newid o fod yn adeiladau milwrol i fod yn henebion ac yn atyniadau twristaidd.

Ceir gwahanol fathau o gestyll wrth gwrs, megis Cestyll y Normaniaid a'r Cestyll Cymreig. Llefydd milwrol ac amddiffynfeydd oedd cestyll yn yr thyredau uchel, ac yn aml hefyd rhagfuriau a ffos o gwmpas. Byddai'r ffenestri yn gul a'r drysau yn drymion. Roedd y castell yn rheolir dref hefyd yn aml, gyda  mur o gwmpas y dref yn ogystal a bont godi a thrwy borthdy cryf â chlwydi a phorthcwlis. Roedd donjon (carchar dan ddaear) mewn llawer o'r cestyll. Weithiau byddai'r castell dan warchae am gyfnod hir a byddai rhaid ildio oherwydd diffyg bwyd.

Roedd y castell yn lle i drigo yn ogystal â bod yn amddiffynfa. Roedd ward fewnol, llety, ystafelloedd byw ac siambrau cysgu, rhai ohonyn nhw'n gyfforddus iawn, gwrw, canolfan weinyddol a chapel. Roedd stablau i'r meirch ac ysguborau i gadw bwyd iddynt. Ond y peth pwysicaf i gyd oedd ffynnon neu ffynhonnell dŵr arall i gadw'r amddiffynwyr yn fyw adeg gwarchae. Gwarchae oedd un o'r bygythiadau gwaethaf i gastell a dyna pam yr oeddent yn ceisio bod mor hunangynhaliol â phosibl.

Roedd hi'n anodd i godi'r cestyll hyn weithiau am eu bod yn aml yn cael  eu codi ar dir estron. Yn achos y cestyll Seisnig yng Nghymru yr oedd rhaid cael gweithwyr a chrefftwyr o Loegr neu gyfandir Ewrop ac fe'i gorfodid i adael eu cartrefi i weithio yng Nghymru, efallai am flynyddoedd.

Yr oedd rhaid codi llawer o arian i godi'r cestyll hefyd. Y goruchwylwyr oedd yn gofalu am yr ochr ariannol ac yn talu'r gweithwyr. Y pensaer oedd yn gyfrifol am gynllunio'r castell a dewis safle i'w adeiladu. Y nesaf at y pensaer mewn pwysicrwydd oedd y saer maen. Roedd yn bwysig cael chwarel yn gyfleus i gael meini i'r muriau. Byddent yn hollti'r cerrig yn y chwarel i arbed cludo cerrig diwerth heb eisiau. Roedd rhaid cael cerrig da a fyddai'n gorwedd yn esmwyth ar ei gilydd er mwyn gwneud y muriau allanol yn gadarn.

== Cestyll Cymru ==
200px|bawd|chwith|[[Castell Cricieth]]
:''Gweler hefyd Cestyll y Tywysogion Cymreig a Rhestr cestyll Cymru''.
Cafodd nifer o gestyll eu codi gan y tywysogion Cymreig, yn arbennig yn y cyfnod rhwng yr 11eg ganrif a thrydydd chwarter y 13eg ganrif. Yn eu plith mae Castell Dolbadarn, Castell Dolwyddelan, Dinas Emrys, Castell y Bere, Castell Cricieth, Castell Carreg Cennen, Castell Dinefwr, Castell y Dryslwyn, a Castell Dinas Brân.

300px|thumb|[[Windsor Castle is an official residence of the monarch of the United Kingdom and is over 900 years old.]]
A '''castle''' is a defensive structure seen as one of the main symbols of the Middle Ages. The term has a history of scholarly debate surrounding its exact meaning, but it is usually regarded as being distinct from the general terms fort or fortress in that it describes a building which serves as a residence of a monarch or noble and commands a specific defensive territory.

Roman forts and Carolingian France. The advent of cannon and gunpowder changed the needs of warfare in Europe, limiting the effectiveness of the castle and leading to the rise of the fort.

Similar constructions in Shiro'') are also considered castles.
<!-- 

PLEASE CONSIDER NOT ADDING NEW PICTURES. THIS ARTICLE IS OFTEN PURGED OF IMAGES, WHEN TOO MANY ARE ADDED. PLEASE CONSIDER INSTEAD THE WIKICOMMONS GALLERY, LINKED AT THE END OF THE ARTICLE, WHICH IS PERMANENT. PLEASE READ THE ARTICLE BEFORE YOU ADD TEXT-PEOPLE KEEP ADDING THE SAME THINGS IN EVERY SECTION (for example, concentric castles'').

-->

==Definition==
Castle comes from the Latin word ''castellum''. This is a diminutive of the word ''castrum'', which means "fortified place".  The word "castle" ('''Castell''') was introduced into English shortly before the Norman Conquest to denote this type of fortress, then new to England, brought in by the Norman shiro'' also figure prominently in Japanese history, where the feudal ''daimyō'' inhabited them. 

A French castle is a '''Château-Fort''', for in French a simple ''château'' connotes a grand estate, with non-military, purely residential function. When European castles were opened up and expanded into pleasure dwellings and power houses from the late 15th century, their "castle" designations, relics of the feudal age, often remained attached to the dwelling, resulting in many non-military castles and ''châteaux''. 

In Germany there are two names for what would be called a castle in English, ''Burg'' ('''Burh''') and ''Schloss''.  A ''Burg'' is a medieval structure of military significance, while a ''Schloss'' was built after the Middle Ages as a palace and not for defensive purposes.  However, these are not usually palaces in the French style, but instead are styled on medieval mountain castles and fairytale notions, and from all appearances are often castles to an English speaker.

In Celtic countries, ''Caer'' or ''castell'' (Welsh), ''dún'' and ''caisleán'' (Irish), ''dùn'' and ''caisteal'' (Scots Gaelic) are used.

In spite of the generally accepted definition, the word "castle" is sometimes used to mean a Britain it has also been used to refer to prehistoric earthworks (e.g. Maiden Castle). The use of the Spanish equivalent ''castillo'' can be equally misleading, as it can refer to true castles and forts (eg. Castillo de San Marcos); terms such as ''Fortaleza'' ("fortress") are in similar situations.

thumb|left|220px|The Norman "White Tower", the [[keep of the Tower of London, exemplifies all uses of a castle: city defence, a residence, and a place of refuge in times of crisis.]]
====Defining features====

The chief distinguishing features of castles, as opposed to other defensive structures, can be defined as follows:

*Castles were places of protection from an invading enemy, a place of retreat. This is the purpose behind such stereotypical castle features as portcullises, battlements and drawbridges.

*Castles were also offensive weapons, built in otherwise hostile territories from which to control surrounding lands, as forward camps. In particular, during the High Middle Ages, castles were often built for territorial expansion and regional control. A castle was a stronghold from which a lord could control surrounding territory. 

*Castles were either built as, or evolved into, residences for the monarch or lord who built them. 

These three purposes distinguish the castle from other fortresses &mdash; which are usually purely defensive (like citadels and city walls) or purely offensive (a military camp) &mdash; or edifices that are entirely residential in nature, like palaces. Castles such as the Tower of London served as prisons.<ref name="Pockets">Philip Wilkinson, ''Castles (Pocket Guides)''. Publisher: DK CHILDREN; Pocket edition (September 29, 1997). ISBN 0789420473. ISBN 978-0789420473 </ref>

thumb|right|300px|The [[Al-Andalus|Moorish Royal palace after the Reconquista.]]

====Evolution====
A castle was not only a bastion and place for detention of prisoners but also a social place where a knight or lord could entertain his peers.  Over time the aesthetics of the design increased in importance, as the appearance and size began to reflect the prestige and power of the occupant.

Castles were built as defensive measures and offensive weapons, but often over time comfortable homes evolved within the fortified walls. An example is the Queen of the United Kingdom. The palace under Charles V.

==Architecture and development==
===Early castles===
thumb|left|200px|[[Ambleside Roman fort, Cumbria.]]
====Antecedents====
From as early as oppida'') built by their enemies. Though primitive, they were often effective and required extensive siege engines and other siege warfare techniques to overcome, such as at the Battle of Alesia. The Romans own fortifications (castra) varied from simple temporary earthworks thrown up by armies on the move, to elaborate permanent stone constructions, notably the milecastles of Hadrian's Wall. Roman forts were generally rectangular with rounded corners. The Roman engineer Vitruvius was the first to note the three main advantages of round corner towers: more efficient use of stone, improved defence against battering rams and improved field of fire. It was not until the 13th century that these advantages were rediscovered.

====The first castles====
The earliest recorded structures universally acknowledged by historians as 'castles' were built in the late 9th century, and included wood, earth and stone structures.<ref name="Pockets"/> Roman fortifications, or, when possible or needed, other edifices, were often turned into castles or similar structures during the early Middle Ages. A famous example is that of the Hadrian's Mausoleum in Gothic War.<ref>Royal, Robert. ''The Pope's Army: 500 Years of the Papal Swiss Guard''. Crossroads Publishing Co, 2006.</ref> Other late Antiquity-early Medieval castles survive in Brescia and Trento in Italy
thumb|300px|right|One of the earliest representations of a castle from the [[Bayeux Tapestry.]]
Construction of new castles in Europe is attested from the Carolingian era, but their construction seems to have been related mainly to the defence of frontiers and state properties, and the right to fortify was a royal privilege. As early as 864, Charles the Bald issued an edict ordering the destruction of private fortifications erected without his permission. However, changes took place from the late 9th century, probably under the pressure of raids by the Vikings and Magyars, and due to the general decline of the Carolingian Empire, and the consequent loss of centralized authority, which resulted in a proliferation of castles.<ref name="Pockets"/>  There was also frequent fortification of cities, monasteries, ports and rural settlements in this period. In 906, a deacon in Verona asked Berengar I of Italy for permission to build a castle in Nogara "due to the heathens ravages". 

As the Carolingian Empire broke up into duchies and counties, factions struggling for power created a military infrastructure, to protect their rights, their domains, and their followers. It is within this historical context that feudalism began to emerge. The early castle formed an integral part of feudalism: it provided a residence for the lord; provided protection for his followers as guaranteed by their feudal oaths of loyalty and allegiance, while the garrison of the castle was made up of the lord's followers, as per their feudal obligations. Many examples of defensive programs as part of feudalism exist. In the 10th century for example, in the Loire Valley, Fulk Nerra embarked on a massive castle-building program to control his county of Anjou, and neighbouring Touraine. In Normandy at around the same time, a military state emerged with a dense network of castles and feudal allegiances. Similar arrangements with regards to defensive and holding of territory also occurred in other parts of Europe around this time. .

Castles were introduced to the British Isles around the early 11th century, by Norman-French followers of King Edward the Confessor.[http://www.castlewales.com/richards.html] When William the Conqueror executed the Norman Conquest of England, he brought with him the practice of building a castle to protect and hold the land, by then quite familiar on the mainland of Western Europe

====Residential Towers====
Some of the earliest recognizable castles were essentially fortified residential halls, enclosed by a defensive wall. Halls which functioned as habitation for an important person, chieftain or lord, and his followers, had existed since the earliest times all over Europe. During the times of uncertainty which followed the collapse of Carolingian authority, it became necessary to more strongly fortify the habitation and possessions. As a result the wooden halls were replaced by much stronger stone buildings as early as the 10th century. Examples include Langeais and Doué-la-Fontaine.

====Motte-and-bailey====

thumb|right|300px|The wooden palisades surmounting mottes were often later replaced in stone, as in this example at [[Gisors.]]

:

The motte'' (bailey or ''basse court'' of Gulielmus de Warenne, is an unusual example, as it featured two mottes.<ref name="Pockets"/> Wooden castles were built up until the 12th century.

A description of this earlier castle is given in the life of St John, Bishop of Terouanne:

===Defensive features===
====Keep====
Most castles, even from the earliest times, followed certain standards of design and construction. Generally, the central feature of the castle was the '''bailey or the court, and the enclosure known as the enceinte.

====Enceinte====
The '''concentric plan, where enceinte walls (also called curtain walls) and towers formed two rings around the keep, resulting in an inner and an outer court, pushing the enemy further from the core walls and keep.
thumb|right|300px|[[Carcassonne, France, showing the classic features of the enceinte walls, defensive ditch, cylindrical flanking towers, a gatehouse, and wooden defensive structures]]

====Gatehouse====
The gates were a weak point in the defenses of castles, so gatehouses could be strengthened with flanking towers, a turning or removable bridge, doors, and a heavy portcullis. There would often be multiple portcullises, with arrow slits in the sides of the gate passage, allowing the defenders to trap the enemy and kill them within the gate. Additionally, gates were often placed in such a manner as to channel attacking forces against a series of perilous defensive fortifications, enabling the defenders to defend on their terms. Many gatehouses had a second body. Archers in the second body could shoot down at their enemies while they were defenseless.

====Additional features====
Castles featured an array of defences to delay the attackers' progress towards the keep. Moats and ditches formed the most obvious, as these would have to be filled in before heavy hoardings could be constructed if a castle was under threat. These covered walkways would allow several lines of fire.<ref name="Pockets"/> Later, permanent fixtures known as "machicolation" were built in stone. Perhaps the most notable features of castle defence were the crenellations and merlons, which offered relative cover for archers.<ref name="Pockets"/> "Murder holes" and embrasures might be built into the walls and gatehouse so projectiles could be launched at the attackers.