Castelsarrasin is a commune in the Tarn-et-Garonne department in Midi-Pyrénées region of France. The inhabitants are called Castelsarrasinois. It is the second most populous commune in Tarn-et-Garonne after Montauban.
The first certain evidence of the town dates from 961. The name, Castel Sarracenum, would indicate that the castle was built in the Saracen era. The early history of the city is marked by wars; against the English until the end of the 12th century, then the Albigensian Crusade during the first part of the 13th century, and then the Shepherd's Crusade of 1320 that resulted in the deaths of many Jews in the city. The region was much affected by the Hundred Years' War, and again, during the wars of religion of the 16th century, the city's largely Catholic population was in frequent conflict with the generally Protestant surrounding region.
The region is calmer during the following centuries, up to the time of the French Revolution.
Castelsarrasin was the finish of Stage 17 in the 2007 Tour de France.