The Jews settled in Catalonia in Roman times and communities began to take shape in Barcelona and Gerona in the tenth century. By the twelfth century, there were five major Jewish centers: Barcelona, Gerona, Lerida, Tortosa, and Perpignan (French Catalonia). The Jews are mentioned in Catalonia’s first legal code, Els Usatges de la Cort de Barcelona. They distinguished themselves in agriculture, trade, administration, medicine, and the sciences. They also hosted Jews expelled from France, Germany, and Provence, which explains their influence on the ideas of the Kabbalah. The Black Death of 1348 and the massacres of 1391 almost wiped out Jewish life, which was indeed annihilated by the events of 1492. In the first half of the thirteenth century, the Jewish community is estimated to have numbered between 10000 and 12000, or 4 to 7% of the total population.