The most flourishing age of Trani was the 11th century, when it became an episcopal see in place of Canosa, destroyed by the Saracens. Its port, well placed for the Crusades, then developed greatly, becoming the most important on the Adriatic Sea. In the year 1063 Trani issued the "Ordinamenta et consuetudo maris", which is "the oldest surviving maritime law code of the Latin West". There was also Jewish community in Trani, which was under the protection of the king until it was given to the Archbishop Samarus during the reign of Henry VI at the end of the 12th century. In that period many great families from the main Italian Maritime Republics (Amalfi, Pisa, Genova and Venice) established themselves in Trani. Trani, in turn, maintained a consul in Venice from 12th century. The presence of other consulates in many northern Europe centres, even in England and Netherlands, shows Trani's trading and political importance in the Middle Ages. Emperor Frederick II built a massive castle in Trani. Under his rule, in the early 13th century, the city reached its highest point of wealth and prosperity.