Denbigh Castle, together with its town walls, was built in 1282 by order of King Edward I. The Burgess Gate, whose twin towers adorn the symbol on Denbigh's civic seal, was once the main entrance into the town. The first borough charter was granted to Denbigh in 1290, when the town was still contained within the old town walls. It was the centre of the Marcher Lordship of Denbigh. The town was involved in the revolt of Madog ap Llywelyn in 1294-95; the castle was captured in the autumn, and on 11 November 1294 a relieving force was defeated by the Welsh rebels. The town was recaptured by Edward I in December. Denbigh was also burnt in 1400 during the revolt of Owain Glyndŵr.