Its origins date back to the founding of the Portuguese territory; the earliest written document (953), by the Countess Mumadona Dias, refers to the "Villa de Comite", in a chart used for the sale of land by Flamula Pelagius, to the Monastery of Guimarães. But its ancient origins date back to the Castro of São João (Hillfort of St. John), and other Iron Age castros, that include dispersed settlements in Retorta, Bagunte, Ferreiró, Vairão and Labruge. In the 18th century, Jerónimo Contador de Argote, citing references to the castro culture, identified the existence of one of these structures in the hilltops of "Cividade de Bagunte", a structure occupying . Other castros within the municipality have been mostly agricultural, and some discoveries of ceramics have occurred, although most have been found in ruins. Similar vestiges of the Roman occupation of the region continue to be discovered, and archaeological digs are ongoing in a dozen sites throughout the municipality.