In ancient Egypt and during the reign of Alexander the Great, the city was known as "Amunia". In the Ptolemaic Kingdom and later during the Byzantine Empire, it was known as Paraitónion (). During the Roman Empire, it was called Paraetonium in Latin, which became Al-Baretoun () after the Arab conquest of Egypt. As a British military base during World War II, several battles were fought around its environs as the German Afrika Korps attempted to capture the port. It fell to the Germans during the Battle of Mersa Matruh, but was recaptured following the Second Battle of El Alamein.