In 1862 students of the Chassam Sofer, Rabbi Moses Sofer, arrived in Jerusalem from Hungary and established a community called Shomrei HaChomos, meaning Guardians of the Walls. During the 1870s they built a synagogue situated about 100 meters from the Temple Mount on el-Wad Street, in today's Muslim Quarter. The courtyard was purchased from the Muslim Khaladi family. Rabbi Yitzchok Ratsdorfer, a diamond merchant who belonged to the Hasidic group Belz, financed the building. In 1892 the community established a neighborhood outside the Old City walls called Batei Ungarin, part of the neighborhood now known as Meah Shearim. In 1904 the synagogue in the Old City was expanded and a second story was added. While construction was taking place, the Ottoman authorities warned that the extension would not be allowed. They opposed the fact that its roof would end up being taller than the Dome of the Rock. Construction of the roof was completed overnight, ensuring that the synagogue would be finished. Turkish law stated that once a building had been erected, it could no longer be demolished. The building accommodated a yeshiva on the ground floor called Ohr Meir and its students held study sessions 24 hours a day. The top floor accommodated two prayer rooms, one for the Chasidim, who use Nusach Sefard, and one for the Perushim, who use Nusach Ashkenaz. The building also contained a mikvah.