The castle is protected by strict rules governing development
A 13th Century ruined castle and surrounding land has fetched £838,000 at auction.
Estate agents Strutt and Parker said the land around Ewloe Castle, sold in five lots, was sold to a local farmer who is expected to continue farming it.
The lot including the castle, built in Flintshire by Llywelyn ap Gruffydd, sold for £122,000.
The agents said they were "delighted" with the sale, which had an initial guide price of £500,000.
Although privately owned, the castle is under the custodianship of Welsh historic monuments agency Cadw, who have said its character "must be preserved".
Flintshire Council has also said there are strict guidelines in place to restrict development.
Estimates as to the castle's origins vary, but it is thought to have been built around 1257, as a hunting lodge for the Welsh prince Llywelyn ap Gruffudd.
It stands close to the site where 200 Welshmen, led by the king of north Wales Owain Gwynedd, ambushed - and nearly killed - King Henry II in 1157.
The auction was held at the Beaufort Park Hotel in New Brighton, Flintshire, on Tuesday.