They built their town with the natural timber found all over, namely the Holm Oak, whose name in Croatian, dubrava, gave the town its later name. Mindful of their war-torn origin, they fortified the town against possible invaders.
Invaders came in the form of the Aghlabids of Ifriqiya, functioning as pirates and looking for new territory to conquer. Byzantine records state that the Aghlabids launched a campaign against the south-eastern coasts of the Adriatic in 866. They succeeded in plundering cities along the coast until they reached Ragusa. Finding the city fortified, they set up a siege, intending to wait out the inhabitants.
Ragusa turned out to be better prepared than expected; they withstood the siege for fifteen months! They could not last indefinitely, however, and snuck messengers out of the city to request aid from the Byzantine Empire. Byzantium had once controlled and patrolled the region but had allowed that vigilance to subside; it was their absence that enabled the Aghlabids to invade.
The latest emperor, however, wished to re-assert control over areas to the west. Emperor Basil I sent a fleet of 100 ships under the command of admiral Niketas Oryphas. News of the Byzantine fleet's approach caused the Aghlabids to withdraw. Admiral Oryphas planned future expeditions to push Saracens out of the region, slowly returning the Adriatic and southern Italy to Christian rule.
Every 3 February modern Dubrovnik celebrates with parades and several days of festivities in honor of their patron saint, Sveti Vlaho, or, as he is better known in the West, Saint Blaise. Let me tell you his story next time.