When Llywelyn refused to offer a personal explanation, the king declared him a rebel and in 1277 invaded North Wales.
Although the king's primary target was Gwynedd, Powys Fadog stood in the way. Madog chose to support Llywelyn, and was consequently killed in the fighting. It is thought that Madog may have been buried at Valle Crucis Abbey, of which he was a patron.
Madog was succeeded by his younger brother Gruffydd. The conflict between Llywelyn and the King was settled by the Treaty of Aberconwy, which released Gruffydd and other Welsh princes from any allegiance to Llywelyn.