The reconquista from the Moors by the Franks began in 785. In 785, Rostany (or Rostaing) was made Count of Girona, the first of the Catalan counties to be established. Besalú and Empúries were originally part of Girona. In 801, in the greatest military triumph of his long career, the young Louis took Barcelona, the greatest city of the Catalan littoral. When Urgell and Cerdanya were subdued around 798, they were also made counties and Borrell was made count. He took a very active part in the subsequent conquest of Osona in 799 and the successful siege of Barcelona in 801. He was made count of Osona in 799, perhaps as a reward for his services. In 801, the greatest of the counties, Barcelona, was established under Bera. In 812, Count Odilo of Girona (which included Besalú and Empúries) died and the county also passed to Bera.