Some sort of port has existed in the environs of Tangier throughout most of recorded history, due to its harbor and strategic location on the Strait of Gibraltar. The Portuguese who had occupied the city from the late 15th century to 1662, tried to mitigate the rough waters of the Straits by building a breakwater, but the first truly ambitious attempt to built a port was made after the city was ceded to the English, who promptly began work on a 225 m long and 33 m wide mole of Tangier that they destroyed when driven out of the city in
No attempt was made to rebuild until the late 19th century that a wooden pier was constructed. In the early 20th century piers and breakwaters were built to protect the port from storms. In
1921 the Société du port de Tanger was granted the exclusive right to build and maintain a modern port. Construction that began a few years later and lasted into the beginning of the 20th century included a 960 m breakwater, piers, and facilities for unloading Cargo. After independence control of the port went first to Régie Autonome du Port de Casablanca (RAPC), then to the Office d’Exploitation des Ports puis à l’Agence Nationale des Ports from 1985 to 2006. At that time the administration and maintenance of the port became the responsibility of the Agence Nationale des Ports.
In 2007 a new port, Tanger-Med, went into operation 40 km east of Tangier to handle commercial shipping, and in 2010 the port was closed to all but the ferries from Europe and smaller vessels such as fishing boats. A major refurbishing is now underway. To the east of the ferry terminal, a large area for leisure boating and yachts is being built. A fishing port is being built on the opposite side, and the Port Mosque is being expanded. It appears the Customs House is also being refurbished. The train station in the port is not longer operational, and the tracks to it have been removed. In addition, the beachfront train station just outside the port has been converted to a police station, and the beachfront tracks are also being removed.