During the Second World War Derry played a major role in the Battle of the Atlantic which was being waged against the German U-Boats whose mission was to cut off the lifeline convoy supplies coming across the North Atlantic from Canada, Newfoundland and America. The strategic location and protected river would provide the main operational naval bases for both the Royal Navy and the US Navy. In early 1940, the Admiralty had decided to use Londonderry as a naval base for its north Atlantic operations and work began on the infrastructure of what would be a major resource for ships providing convoy support and protection. The Royal Navy took over Ebrington Barracks which provided the foundation of the HMS Ferret, a shore based facility. At the same time Pennyburn shipyard was taken over to be used for maintenance and repair of ships. The city also provided a base for Canadian, French and Indian navies.

A secret agreement had been worked out between Roosevelt and Churchill early in 1941, before Pearl Harbour and the official US entry to the war (Dec 1941). This agreement was known as the land-lease agreement which would allow US bases to be developed in Northern Ireland and Scotland in return for resources toward Britians war effort which included money, ships and needed supplies. Following on from this agreement in June, 1941 the British government signs a contract with the American Corporation Fuller-Merritt Chapman to begin constructing bases in Northern Ireland and Scotland using $50,000,000 of Lend-Lease funds. Theconstruction program would include a main base for the US Navy at Londonderry for destroyers, submarines and repairs, Lough Erne for Catalina Flying Boats and Rosneath in Ayrshire, for destroyers, submarines and repairs.

Later that same month 350 American personnel arrived to begin the work , they were initially billeted in Ebrington Barracks (HMS Ferret) but later as more arrived they move out to newly constructed camps at Clooney, Springtown, Belmont, Creevagh and Lisahally. The construction that occurred was on a huge scale, Lisahally had a 700 metre jetty built which was connected to the shore by three piers complete with a narrow gauge railway. A mixed fuel tank depot capable of holding 100,000 barrels was completed along with an ammunitions depot. New barracks were built at Ardmore and Pennyburn. The shipyard was expanded and a large repair and machine workshop erected on Strand Road. Mooring points were put in along the quays on both sides of the river.

The US Naval base was commissioned in February 1942 along with a radio communications station. The base became the first US base in Europe, US marines arrived to guard the new base and they were billeted at Beech Hill. Derry effectively became the main terminal for convoy escort vessels, here they would be serviced, armed, repaired and refuelled. By 1943 HMS Ferret was handling on average 150 escort and anti-submarine patrol vessels, two thousand shore-based personnel and twenty thousand British and Canadian seamen. The whole purpose was to protect the essential convoys coming across the Atlantic, this role was supported by the development of airfields at Ballykelly, Aghaloo, Maydown and Eglington. New seaplane bases were also created on Lough Erne. To protect the facilities barrage balloons were put up, 24 heavy and 12 light anit-aircraft guns were installed. These had the supporting fire if need from the any ship moored in the Foyle or Lisahally. Surprisingly the cities major strategic and operational role never drew the attention of the German Luftwaffe for a major air raid. A single bomber did attack the city in April 1941, dropping parachute mines which killed 13 civilians and injured over 30 but that was the only time a raid occurred.

During the period between 1941 and 1944, it is estimated that over 20,000 Royal Navy personnel, 10000 Canadian/Newfoundland personnel and over 8000 US personnel were using the bases. HMS Ferret also had a training facility and R&D unit for anti-submarine weapons like the Squid mortar system. The US base was operational from February 1942 to August 1944 when it was decommissioned. This was not the end of the US Navy presence in Derry though, a month before the base was decommissioned the US Radio Station which had been an integral part of the base was set up as a separate activity and continued to operate until September 1977. It was at that time the oldest US Naval facility in Europe. The importance of the city to the outcome of the war in the Atlantic and the wider land theatre was symbolically demonstrated when the German surrender came in May 1945. U-Boats were instructed to surrender at Lisahally, on arrival the crews were temporarily interned at HMS Ferret. In total over 60 U-Boats would come into Derry some to be allocated amongst the Allies and others scuttled off Malin Head and the North Channel. In July 1945 King George IV, the Queen and Princess Elizabeth visited Lisahally en route to Derry.

The US Naval Radio station continue to serve an important role, during what has become known as the Cold War the station provided a vital role in monitoring the movements of Russian submarines, surface fleet and aircraft. The station was deemed important enough to be on the top level of targets for a Russian nuclear strike if war had broken out. HMS Ferret continued after the war as an anti-submarine training facility and was renamed HMS Sea Eagle. t served as a Joint Anti-Submarine School teaching and training tactical skills and carrying out anti-submarine warfare exercises. In 1970 the site was handed back to the British Army, the old name was re-instated and it became the Headquarters for the 8th Brigade of the British Army. The barracks were originally built in 1841 and named after Viscount Ebrington, then Lord Lieutenant of Ireland. This was the site of an earlier strategic fort dating back to the early 1600s. The barracks have seen several extensions and throughout its history. During the First World War it was home to batallions the Cheshire Regiment, Royal Inniskillen Dragoons and Royal Inniskilling Fusiliers.

In May, 1916 the famous war poet Corporal Francis Ledwidge and writer Lord Dunsany (Edward Plunkett) spent seven months in city. Both were soldiers in the Royal Inniskilling Fusiliers who were posted to Ebrington barracks after being on active duty i Gallipoli, Serbia and Egypt. Ledwidge wrote over three dozen poems here before being posted to France in December 1916. He was killed by a shell at Boesinghe in July 31st 1917 during the Third Battle of Ypres and is buried at Passchendaele. Ebrington Barracks was finally closed in 2004 and today is part of a major regeneration of the city providing recreational, exhibition and entertainment space for residents and visitors. In 2013 the Turner Prize exhibit was hosted in newly converted building on the site. The new pedestrian Peace Bridge connects the site at the Waterside to the main city. Lisahally is the main commercial port for the city and can berth ships up to 30,000 tons, this includes visiting cruise liners.