|Time zone||WET (UTC+0)|
|• Summer (DST)||WEST (UTC+1)|
Ksar es-Seghir or Ksar Sghir or al-Qasr al-Seghir (Moroccan Arabic: القصر الصغير, translit. l-qṣər ṣ-ṣġir), is a small town on the Mediterranean coast in the Jebala region of northwest Morocco, between Tangier and Ceuta, on the right bank of the river of the same name. Administratively, it belongs to Fahs-Anjra Province and the region of Tanger-Tetouan-Al Hoceima. By the census of 2004, it had a population of 10,995 inhabitants.
It is also known by its Portuguese name Alcácer-Ceguer and its Spanish name Alcázarseguir (or more archaically, Castillejo). Its name Ksar es-Seghir ('small castle') contrasts with Ksar-el-Kebir ('large castle') further south. The old name of the city is "Ksar Masmuda" (The Masmuda castle), as reported by 13th-century historian Abdelwahid al-Marrakushi.
The city is circular, a design unusual in medieval Moroccan town planning. It is built from brick and ashlar masonry and flanked by semi-circular masonry towers. There are three monumental doors in the wall, each flanked by square towers. The Bāb al-Bahr (door of the sea), has an elbowed entrance for defensive purposes. These doors were used both for communication and trade and for taxation purposes.
Ksar es-Seghir is located on the Strait of Gibraltar, about half-way between Tangier and Ceuta. Situated in a bay on a stretch of coast that is relatively difficult to access by sea or land, Ksar es-Seghir never grew in size to rival the other north Moroccan ports. However, its sheltered position made it attractive as a military landing ground, a place for the safe and orderly embarkation and disembarkation of sea-borne troops, with little danger of disruption or molestation by enemy action.
Probably established by Phoenicians, it was known as a salting post in Roman times by the name of Lissa or Exilissa (according to Ptolemy)  and Exilyssa (Ancient Greek: Εξιλύσσα) in Byzantine times. The first settlement dates back to the Muslim conquest of the Maghreb in 708-709 CE, when a fort was erected there known as Ksar Mesmouda (after the Masmuda Berbers who lived in the region). In 971, the Umayyad Caliph of al-Andalus tried to capture the fort, as a stepping stone to a projected conquest of Idrisid Morocco. The 11th-century geographer al-Bakri called it al-Qasr al-Awwal ('the first castle'). During the Almoravid and Almohad eras, it was used as a major shipyard, renamed Qasr al-Majaz, Ksar al-Majar or Ksar al-Djawaz ("castle en route") because it was an important embarkation port for Moroccan troops on their way to Spain.
In 1287, Marinid sultan Abu Yaqub Yusuf erected a new set of thick walls around the circular town, with 29 bastions and three monumental gates (Bab al-Bahr, Bab Sebta, Bab Fes). But with the end of Marinid adventures across the sea in Spain, it declined in use. By the 15th century, it had become a notorious corsair's nest, preying on shipping in the Straits of Gibraltar.
In 1458, a Portuguese expeditionary force of 25,000 men and 200 ships led by King Afonso V of Portugal, assaulted and captured the town after a two-day battle on 23–24 October. The Marinid sultan Abd al-Haqq II of Morocco attempted to recover it immediately, laying sieges in late 1458 and again in the summer of 1459, to no avail. It would remain in Portuguese hands for much of the next century, known by the name of 'Alcácer-Ceguer'. In 1502, the Portuguese began a new set of fortifications that extended the town's walls well into the sea, thereby ensuring a shielded landing ground for Portuguese expeditionary forces in Africa. The resident population of the town under the Portuguese reached around 800 persons.
Finding Portuguese holdings in Morocco expensive to maintain, King John III of Portugal decided to abandon it in 1533, although the final evacuation of Ksar es-Seghir would be delayed until 1549. It was recovered by Morocco thereafter, but the departing Portuguese had taken the trouble to evacuate the population, dismantle much of the fortifications and town, and dump debris and sand into the harbor, diminishing its immediate usefulness. In 1609, Ksar es-Seghir became a destination for Moriscos expelled from Spain.
Having lost its role as a transit port, Ksar es-Seghir collapsed in size and importance thereafter, becoming a relatively insignificant fishing town, amid the ruins of the old Moroccan citadel and Portuguese fort. A more modern town arose later, on the right bank of the river, across from the old citadel. Ksar Sghir got a new lease on life in the 21st century, when it was slated as the site of a new naval base for the Royal Moroccan Navy (construction begun 2008, operational 2010). In 2007, a new commercial cargo port, Tanger-Med began being built nearby, around twelve kilometers to the northeast of Ksar Sghir.
- Haut Commissariat au plan, Census 2004 Archived 1 June 2010 at the Wayback Machine.
- Qantara Mediterranean Heritage
- "Tangier, Ksar es Seghir, Terremaroc.com : Riad Marrakesh | Villa Marrakesh | Riad Essaouira | Guest House Morocco". www.terremaroc.com. Retrieved 2018-02-16.
- "Le Maroc se dote de sa première base navale - Afrik.com : l'actualité de l'Afrique noire et du Maghreb". www.afrik.com. Retrieved 2018-02-16.
- Pike, John. "Royal Moroccan Navy". www.globalsecurity.org. Retrieved 2018-02-16.
- Braga, Paulo Drumond. A Expansão no Norte de África. In: Nova História da Expansão Portuguesa (dir. de Joel Serrão e A. H. de Oliveira Marques). Lisboa: Editorial Estampa, 1998. Vol. II, A Expansão Quatrocentista. p. 237-360.
- Duarte, Luís Miguel. África. In: Nova História Militar de Portugal (dir. de Themudo Barata e Nuno Severiano Teixeira). Lisboa: Circulo de Leitores, 2003. vol. I, p. 392-441.
- Elbl, Martin Malcolm. "The Master-Builder, the Bureaucrat, and the Practical Soldier: Protecting Alcácer Seguer/Qasr al-Saghir (Morocco) in the Early Sixteenth Century," Portuguese Studies Review 12 (1) (2004/5), p. 33-73. 
- Redman, Charles L.. Qsar es-Seghir: an archaeological view of medieval life. London, Academic Press, 1986.