.After Wilfred ‘el Velloso’ (the Hairy, 878 -97) the title became hereditary, and under Borrell II (947-92) Barcelona became the capital of an independent state (988).
Ramon Berenguer I and his brother linked the old border territories under their command, and the kingdom of Catalonia was born. The first nobleman to hold the title of king was Alfonso I (1162-96), who reigned over Catalonia and Aragon (united by marriage), but also Provence, Béarn, Bigorre, Carcassonne,
Béziers, Nîmes and Nizza.
The Catholic King Pedro I (1196-1213) lost most of the French provinces as well as his life by taking part in the Crusades; the Catalans only managed to hold on to Roussillon and Montpelier. His successor, James I, known as the Conqueror, started by moving into the Mediterranean. He took the two largest Balearic Islands (Mallorca in 1235, Ibiza in 1238), and also the province of Valencia. Succeeding kings annexed Corsica, Sardinia, Sicily and Greece. Barcelona remained the capital until the reign of the
Catholic King Ferdinand II, after which the royal seat moved first to Burgos and then to Madrid.
Barcelona kept a viceroy and remained capital of its province, representing Barcelona in general, until Philip V, on the side of Charles of Austria,
stripped it of its rights during the War of the Spanish Succession (1701-13). In 1860 the city we see today began to develop