From the early stages of World War I, Andranik commanded the first Armenian volunteer battalion within the Russian Imperial army against the Ottoman Empire, capturing and later governing much of the traditional Armenian homeland. After the Revolution of 1917, the Russian army retreated and left the Armenian irregulars outnumbered against the Turks. Andranik led the defense of Erzurum in early 1918, but was forced to retreat eastward. By May 1918, Turkish forces stood near Yerevanthe future Armenian capitaland were halted at the Battle of Sardarabad. The Dashnak-dominated Armenian National Council declared the independence of Armenia and signed the Treaty of Batum with the Ottoman Empire, by which Armenia gave up its rights to Western Armenia. Andranik never accepted the existence of the First Republic of Armenia because it included only a small part of the area many Armenians hoped to make independent. Andranik, independently from the Republic of Armenia, fought in Zangezur against the Azerbaijani and Turkish armies, and helped to keep it within Armenia.