Though settlement in the area goes back to Roman times, the medieval town of Perpignan seems to have been founded around the beginning of the 10th century (first mentioned in a document as villa Perpiniarum in 927). Soon Perpignan became the capital of the counts of Roussillon. In 1172 Count Girard II bequeathed his lands to the Counts of Barcelona. Perpignan acquired the institutions of a partly self-governing commune in 1197. French feudal rights over Roussillon were given up by Louis IX in the Treaty of Corbeil (1258).
When James I, the Conqueror, king of Aragon and count of Barcelona, erected the Kingdom of Majorca in 1276, Perpignan became the capital of the mainland territories of the new state. The succeeding decades are considered the golden age in the history of the city. It prospered as a centre of cloth manufacture, leather work, goldsmiths' work, and other luxury crafts. King Philip III of France died there in 1285, as he was returning from his unsuccessful crusade against the Aragonese Crown.
In 1344 Peter IV of Aragon annexed the Kingdom of Majorca and Perpignan once more became part of the County of Barcelona. A few years later it lost approximately half of its population owing to the Black Death. It was attacked and occupied by Louis XI of France in 1463; a violent uprising against French rule in 1473 was harshly put down after a long siege, but in 1493 Charles VIII of France, wishing to conciliate Spain in order to free himself to invade Italy, restored it to Ferdinand II of Aragon.
Again besieged and captured by the French during the Thirty Years' War in September 1642, Perpignan was formally ceded by Spain 17 years later in the Treaty of the Pyrenees, and began then to form part of the Kingdom of France.
The cathedral of St. John the Baptist was begun in 1324 and finished in 1509.
The 13th century palace of the kings of Majorca sits on the high citadel, surrounded by ramparts, reinforced for Louis XI and Charles V, which were updated in the 17th century by Louis XIV's military engineer Vauban.
The walls surrounding the town, which had been designed by Vauban, were razed in 1904 to accommodate urban development.
Traditional commerce was in wine and olive oil, corks (the cork oak Quercus suber grows in Perpignan's mild climate), wool and leather, and iron. In May 1907 it was a seat of agitation by southern producers for government enforcement of wine quality following a collapse in prices.
Perpignan is a rugby stronghold: their rugby union side, USA Perpignan, is a regular competitor in the Heineken Cup, and their rugby league side plays in the Super League under the name Catalans Dragons.
Perpignan has a close connection with the sculptor Aristide Maillol, who attended school there.
Following a visit in 1963, the Catalan (Spain) surrealist artist Salvador Dalí declared the city's railway station the centre of the Universe, saying that he always got his best ideas sitting in the waiting room. He followed that up some years later by declaring that the Iberian Peninsula rotated precisely at Perpignan station 132 million years ago - an event the artist invoked in his 1983 painting Topological Abduction of Europe - Homage to Rene Thom.
In 2008, Perpignan becomes Capital of Catalan Culture.