It is not known when Trincomalee started to function as harbor or gained military significance since the days of the ancient Sri Lankan Kings. The earliest known reference to the port of Gokanna is found in the Mahavamsa stating that in the 5th century BC, when King Vijaya who having failed to convince his brother to come to Sri Lanka as his successor, got down his youngest son Panduvasdeva, who landed at Gokanna and was subsequently enthroned at Upatissagama. King Parakramabahu I used Gokanna as his eastern port, to launch a successful invasion of Burma in the 12th Century. Trincomalee which is a natural deep-water harbour that has attracted seafarers like Marco Polo, Ptolemy and Sea Traders from China and East Asia. An English sea captain and historical chronicle writer named Robert Knox came ashore by chance near Trincomalee and surrendered to the military detachment of Dissawa of the King of Kandy in 1659. Hence, it was an important trade city between Sri Lanka and the outside world. With the expansion of the Portuguese colonial possessions in the coastal areas, they built a fort in 1623 which was captured in 1639 by the Dutch. Known as Fort Fredrick it went through a phase of dismantling and reconstruction until was attacked and captured by the French in 1672. The French handed it back to the Dutch East India Company at the Peace of Paris in 1784. In 1795 it was taken over by the British, and the British maintained a garrison till 1948. Trincomalee was the first land to be captured by the British who fought and defeated the Dutch, who did not want to surrender Ceylon as directed by the Prince of Orange, who took refuge in London after being defeated by the French republicans under Napoleon.
The importance of Fort Fredrick was due to Trincomalee's natural harbour. Through Trincomalee, it was believed a strong naval force could secure control of India's Coromandel Coast. It is stated that Trincomalee was visited by ColonelArthur Wellesley and MidshipmanHoratio Nelson at different times during their service in India. Lord Nelson visited whilst serving as a midshipman on board and would called it the finest harbors in the world. Arthur Wellesley visited whilst a Colonel in the British East India Company, the bungalow he resided in is known as Wellesley Lodge which is inside Fort Fredrick and now is the officer's mess of the 2nd battalion of the Gajaba Regiment. Prior to the Second World War, the British built the Royal Air Force base, RAF China Bay, as well as fuel oil storage and support facilities for the Royal Navy's shore establishment,. After the fall of Singapore, Trincomalee became the home port of the Eastern Fleet of the Royal Navy, and submarines and flying boats of the Dutch Navy. The harbour and airfield were attacked by a Japanese carrier fleet in April 1942 in the Indian Ocean Raid. Until 1957, Trincomalee was an important base for the Royal Navy and was home to many British people who were employed by the British Admiralty. In the early 1950s The British Government built groups of bungalows within the Fort specifically for their employees. These bungalows still exist and provide accommodation for soldiers of the Sri Lankan Army. One of the groups of bungalows was named Edinburgh Terrace. Children of the British residents attended a Royal Naval School which was part of the Naval Base. The naval and air bases were taken over by Sri Lanka in 1957, today SLNS Tissa and SLN Dockyard are used by the Sri Lankan Navy, while the Sri Lanka Air Force is based at SLAF China Bay. The Sri Lanka Army has its Security Forces Headquarters - East in Trincomalee. Trincomalee War Cemetery, is one of the six commonwealth war cemeteries in Sri Lanka, it is maintained by Sri Lankan Ministry of Defence on behalf of the Commonwealth War Graves Commission. The Navy Base is home to a naval museum called The Hoods Tower Museum. The name of the museum refers to a watchtower built on a hill commanding a 360-degree view of the harbor and the bay.