Montenegro, under Nicholas I, expanded its territories after the Montenegrin–Ottoman War of 1876–1878 and was internationally recognized in 1878 by the Treaty of Berlin as an independent nation. The newly acquired lands had a large Muslim population, and the provisions of Treaty of Berlin guaranteed Muslims in Montenegro the freedom of religion and the right of religious endowment (waqf) property. In 1878, with the approval of Shaykh al-Islām, the first Mufti of Montenegro Salih Efendi Huli was chosen.