Morocco has a coast on the Atlantic Ocean that reaches past the Strait of Gibraltar into the Mediterranean Sea. It is bordered by Spain to the north (a water border through the Strait and land borders with three small Spanish-controlled exclaves, Ceuta, Melilla, and Peñón de Vélez de la Gomera), Algeria to the east, and Western Sahara to the south. Since Morocco controls most of Western Sahara, its de facto southern boundary is with Mauritania.
The internationally recognized borders of the country lie between latitudes 27° and 36°N, and longitudes 1° and 14°W. Adding Western Sahara, Morocco lies mostly between 21° and 36°N, and 1° and 17°W (the Ras Nouadhibou peninsula is slightly south of 21° and west of 17°).
The geography of Morocco spans from the Atlantic Ocean, to mountainous areas, to the Sahara (desert). Morocco is a Northern African country, bordering the North Atlantic Ocean and the Mediterranean Sea, between Algeria and the annexed Western Sahara
A large part of Morocco is mountainous. The Atlas Mountains are located mainly in the center and the south of the country. The Rif Mountains are located in the north of the country. Both ranges are mainly inhabited by the Berber people. At 172,402 sq mi (446,519 km2), Morocco is the fifty-seventh largest country in the world (after Uzbekistan). Algeria borders Morocco to the east and southeast though the border between the two countries has been closed since 1994.
Spanish territory in Morocco comprises five enclaves on the Mediterranean coast: Ceuta, Melilla, Peñón de Vélez de la Gomera, Peñón de Alhucemas, the Chafarinas islands, and the disputed islet Perejil. Off the Atlantic coast the Canary Islands belong to Spain, whereas Madeira to the north is Portuguese. To the north, Morocco is bordered by and controls part of the Strait of Gibraltar, giving it power over the waterways in and out of the Mediterranean sea.
The Rif mountains occupy the region bordering the Mediterranean from the north-west to the north-east. The Atlas Mountains run down the backbone of the country, from the south west to the north east. Most of the south east portion of the country is in the Sahara Desert and as such is generally sparsely populated and unproductive economically. Most of the population lives to the north of these mountains, while to the south is the desert.
To the south, lies the Western Sahara, a former Spanish colony that was annexed by Morocco in 1975 (see Green March). Morocco claims that the Western Sahara is part of its territory and refers to that as its Southern Provinces.
Morocco’s capital city is Rabat; its largest city is its main port, Casablanca. Other cities include Agadir, Essaouira, Fes, Marrakech, Meknes, Mohammadia, Oujda, Ouarzazat, Safi, Salé, Tangier and Tétouan.
Morocco is represented in the ISO 3166-1 alpha-2 geographical encoding standard by the symbol MA. This code was used as the basis for Morocco’s internet domain, .ma.