Ultimately, under the Qajars Persia was shaped into its modern form. Initially, under the reign of Agha Mohammad Khan Persia won back many of its lost territories, notably in the Caucasus, only to be lost again through a series of bitter wars with Russia. In the west the Qajars effectively stopped enroachment of their Ottoman archrival in the Ottoman–Persian War (1821–23) and in the east the situation remained fluid. Ultimately, through Qajar rule the military institution was further developed and a capable and regionally superior military force was developed, which saw limited service during the Persian Campaign of the [[World War I|First World War.