The first Jews settled in Zamość in 1588, eight years after the founding of the town by Chancellor Jan Zamoyski. They were Sephardim coming from the Ottoman Empire and Venice and consequently established the northernmost Sephardi community in Central and Eastern Europe. It was the Sephardim that built the first synagogue in Zamość in the 1590s as a wooden structure. In 1610, after restrictions prohibiting Jews from building synagogues from stone were rescinded, the current brick building was erected, taking eight years to complete. The original Sephardi community ceased to exist in the 1620s when it assimilated into the fledgling Ashkenazi community, following an economic crisis caused by the accumulation of bad debts by Polish debtors. Ashkenazi Jews had begun settling in Zamość at the beginning of the 17th century having been attracted by the commercial significance of the town. The influx of Ashkenazi Jews increased in the 1640s, especially by refugees fleeing the anti-Jewish perpetrated by the troops of Bohdan Khmelnytsky during the Ukrainian revolt against Polish rule.