In the "Historia Brittonum" a king named Vortigern wanted to built a castle on a hill, but for apparently no reason, it always tumbels down. After a boy without natural father(assumed to be the young Merlin) told him that there are two dragons fighting beneath that hill, the king excavates the hill, freeing the dragons. They continue their fight in the air until the red dragon finally wins and becomes the national symbol of Wales, perpetuated on the welsh flag.
In the "Mabinogion" the red dragon fights the invading white dragon, but their horrible fight is tearing the land appart. The king seeks help from his wise brother and is told to dig a hole in the middle of Britain, fill it with mead and cover it with cloth. After doing so, the dragons drink the mead, fall asleep and become entangled in the cloth. While they are still asleep, the king takes both of them prisoner.