In the late Anglo-Saxon era, the threat of Norse invasion was constant. For a time England had a Danish king in the person of Cnut (Canute) but after his death the Anglo-Saxon Edward the Confessor did his best to keep the Norse threat at bay.
The key to the security of the realm as Edward saw it was to control the English Channel. To this end, he granted the ports of Sandwich, Dover, and New Romney, all in Kent, the right to keep all legal fees assigned in court cases. This was quite a profitable concession for the towns involved, and made them far more prosperous than most towns of similar size elsewhere in the country.
In exchange, the towns agreed to provide ships and sailors for defence when required by the crown. To the original three ports were later added Hastings in Sussex, and Hythe, in Kent.
These five coastal towns made up the Five Ports (in Norman French the "Cinque Ports"). In the 13th century Rye and Winchelsea joined nearby Hastings and in the next century gained legal status as "Antient Towns", affiliated with the Cinque Ports.
The need for defence was so great that a large number of other towns became allied to the major ports. Thus, inland Tenterden became an ally of Rye, and Pevensey an ally of Hastings. This 'coastal confederation' reached a total of 42 towns at its medieval peak.
The ports took full advantage of their special legal status to spread their economic reach far beyond their local areas. Thus Rye battled fiercely with Yarmouth in Norfolk for control of the herring fishery on the Norfolk Broads.
The fortunes of the Cinque Ports varied. Dover, with its excellent coastal harbour, prospered. Others fared less well. The sea receded over the medieval period, and rivers silted up, leaving Winchelsea and Tenterden totally isolated from the coast. Rye transformed from a coastal port into a river one, with subsequent loss of trade.
Once bustling, prosperous towns (perhaps a little puffed up with their own importance) dwindled into villages or tourist centres as the need for their defensive contribution declined.
Walmer Castle near Deal (Kent) is the official residence of the Warden of the Cinque Ports, a post little more than ceremonial today, but once of huge national importance. The current (2005) Warden is Admiral the Lord Boyce, and past wardens include the Queen Mother, Winston Churchill and the Duke of Wellington. The "Cinque Ports" and the two Antient Towns still retain their unique legal status in Britain.