The first tunnels under Dover Castle were constructed in the Middle Ages to provide a protected line of communication for the soldiers manning the northern outworks and to allow the garrison to gather unseen before launching a surprise attack. During the Napoleonic Wars, this system of tunnels was greatly expanded to fortify the Castle in readiness for a French invasion. Seven tunnels (running with damp and prone to collapse) were dug as barracks for the soldiers and officers who were filling both castle and town to overflowing. These were capable of accommodating up to 2,000 troops. They are the only underground barracks ever built in Britain. In May 1940, as France fell before the German advance, the tunnels became the nerve centre for 'Operation Dynamo' - the evacuation of the British Expeditionary Force (BEF) and French troops from Dunkirk's beaches. Admiral Ramsay and his staff worked round the clock for nine days. On 26 May some 400,000 troops were awaiting rescue on the beaches of Dunkirk. The best estimate was that only 45,000 could be brought back. Yet, by 4 June, nearly all were evacuated. In total, 338,000 men came back: the BEF and 139,000 French soldiers. In the Second World War there was also a hospital in the tunnels complete with operating theatre. Fortunately casualties were lower than expected and later in the war some of the ward tunnels were given over to dormitories and mess accommodation for military personnel based at the castle.The main military telephone exchange was installed in the tunnels in 1941. Manually operated, it linked Dover to the Admiralty, the War Office and the Air ministry, to the fighter airfields, anti-aircraft batteries, naval bases, coastal artillery and radar sites.In the Cold War the tunnels were further expanded to form a Regional Centre of Government in the event of nuclear war. With the fall of the Berlin Wall in 1989 the need for this facility decreased and in the early 1990s it was decommissioned and areas of the tunnels opened to the public.