Cefnllys Castle (, ) was a medieval spur castle in Radnorshire (now part of Powys), Wales. Two successive masonry castles were built on a ridge above the River Ithon known as Castle Bank () in the thirteenth century, replacing a wooden motte-and-bailey castle constructed by the Normans nearby. Controlling several communication routes into the highlands of Mid Wales, the castles were strategically important within the Welsh Marches during the High Middle Ages. As the seat of the fiercely contested lordship and cantref of Maelienydd, Cefnllys became a source of friction between Llywelyn ap Gruffudd and Roger Mortimer in the prelude to Edward I's conquest of Wales (1277–1283). Cefnllys was also the site of a borough and medieval town. Castle Bank is often considered to be the site of an Iron Age hillfort, but there is no firm evidence to corroborate this. It has also been speculated that the princely court of a native Welsh ruler was situated nearby. The first castle at Cefnllys, north of the ridge, was a motte-and-bailey thrown up during the early stages of the Norman invasion of Wales by the Anglo-Norman baron Ralph Mortimer, beginning a long association between the powerful Mortimer family and Cefnllys. Around 1242, after a century of prolonged conflict in the region, Ralph Mortimer II built a masonry castle on the north-east flank of Castle Bank, which quickly became the principal symbol of Mortimer hegemony in Wales. The castle was captured and slighted in 1262 by Llywelyn ap Gruffudd, Prince of Wales and Gwynedd, during a war with Henry III of England, and Cefnllys featured prominently in the ensuing Treaty of Montgomery. The construction of a new castle on the south-east side of the hill by Roger Mortimer was a contributing factor to Llywelyn's refusal to swear fealty to Edward I in 1275, leading to war in 1277. The castle may have been sacked during the revolts of Madog ap Llywelyn (1294–1295) and Owain Glyndŵr (1400–1415), but remained occupied until at least the mid-15th century, when it was described in a series of poems by the bard Lewys Glyn Cothi. Both castles on Castle Bank are now entirely ruinous and only traces remain; the sole surviving medieval structure at Cefnllys is St Michael's Church. The town was unsuccessful and disappeared altogether as a result of the Black Death and subsequent bubonic plague outbreaks, economic remoteness and changing frontier military conditions, although Cefnllys