Alcoutim (Portuguese pronunciation: [ɐlkowˈtĩ] (listen)) is a town and a municipality in southeastern Portugal near the Portugal–Spain border. The population in 2011 was 2,917, in an area of 575.36 km². It is the least densely populated municipality in Portugal. The municipality is limited on the north by Mértola Municipality, on the east by Huelva Province in Spain, on the southeast by Castro Marim Municipality, on the southwest by Tavira Municipality and on the west by Loulé Municipality and Almodôvar Municipality. The administrative center is the town of Alcoutim, located at the extreme eastern part of the municipality on the Spanish frontier, just across the Guadiana River from the Spanish town of Sanlúcar de Guadiana in Huelva Province. The Moorish Alcoutim Castle, located in the municipality, dates from the 14th century.