The discovery of late paleolithic tools and cave paintings at the Cave of Tourasse and Cave of Montconfort on the edge of the town indicates that the area was inhabited approximately 12,000 - 17,000 years ago.
The town was originally called Calagurris and probably started as a way-station on the Roman road from Toulouse to Lugdunum Convenarum, where a bridge gave access to the road to the Roman settlements at Salies-du-Salat and Saint-Lizier.
Vigilantius, an early Christian priest, was born about 370 at Calagurris. The son of an innkeeper, he traveled to the Holy Land to stay with Saint Jerome in Bethlehem. However, they disagreed on matters of theology and, upon his return to Europe, his comments about this caused Saint Jerome to write one of his most outspoken polemics, Contra Vigilantium.[3]
The name of the city is said to come from a holy monk named Martyrius living in Asia Minor. His relics were placed in the church of Saint Martory.[4] and in 972, the town was renamed Santo Martorio after him.[5]
In the Middle Ages, under the rule of the lords of Montpezat, the town was fortified, with a castle overlooking the town built in the 12th century. Each of the main roads out of the town was guarded with a gate, two of which still exist. To the north east of the town, there was another gate with an iron portcullis, set below directly below the castle.[6]
In 1525 the Montpezat family abandoned their medieval fortress above the town and built a renaissance chateau on the river banks in order to control the trade on the Garonne river. Shortly after the French Revolution, the Prince of Berghes married the daughter of the new owner and decided to make the Chateau de Saint-Martory their summer residence. Architect Ruprich Robert was hired to modernize the building and turned it into a major example of Gothic Revival.
In 1866 Napoleon III ordered the construction of the Saint Martory canal, starting in the town and ending in Toulouse, to provide agricultural irrigation on the west side of the wide Garonne valley.