 After the Ottoman defeat in the Great Turkish War and the Treaty of Karlowitz (1699), a separate Kingdom of Slavonia was formed out of the regained territories, confirming the established borders of the Kingdom of Croatia.Pursuant to provisions of the Croatian-Hungarian Settlement of 1868, Slavionia was added to the Kingdom of Croatia-Slavonia—the territory ruled from Zagreb—and the military frontier was abolished.Rijeka was removed from the new kingdom, as the Corpus separatum attached it to Hungary instead.