Painscastle (Welsh: Castell-paen) is a castle and community in Powys, Wales and also a village which takes its name from the castle. It lies between Builth and Hay-on-Wye, approximately 3 miles from the Wales-England border today. The population as of the 2011 UK Census was 524.
The first castle would appear to have been built by Pain fitzJohn. The site was probably what remained of a much earlier Roman fort, so naturally defensible. The ground plan is rectangular and Roman artifacts have been found at the site.
Pain fitzJohn was killed by a Welsh raiding party in 1137 and Elfael in which Painscastle stands, was taken over by the native Welsh ruler, Madog ab Idnerth.
The castle remained in Welsh hands until about 1195 when the area was captured by William de Braose, 4th Lord of Bramber, who refortified the castle. His formidable wife Maud de Braose, also known as Matilda, held Painscastle against the Welsh for a few months.
In 1196 Rhys ap Gruffudd of Deheubarth defeated the Marcher Lords in a battle at Radnor 8 miles to the north and also besieged Painscastle, but did not actually take it as terms were agreed. In 1198 Gwenwynwyn ab Owain of Powys raised a large army to besiege the castle, but was heavily defeated by an army led by the Justiciar, Geoffrey fitz Peter. This English army formed at nearby Hay on Wye.