Following the Russian Revolution in 1917 the peoples of the southern Caucasus had declared the Transcaucasian Democratic Federative Republic (TDFR) in 1918 and started peace talks with the Ottomans. Internal disagreements led to Georgia leaving the federation in May 1918, followed shortly thereafter by Armenia and Azerbaijan. With the Ottomans having invaded the Caucasus and quickly gained ground, the three new republics were compelled to sign the Treaty of Batum on 4 June 1918, by which they recognised the pre-1878 Ottoman-Russia border, thereby ceding most of Nakhchivan and a considerable part of western Armenia to the Ottomans. Armenia in particular was reeling from the aftermath of the Ottoman-led Armenian genocide, which had resulted in vast numbers of refugees fleeing eastern Turkey. The borders between the three new republics were all disputed. War broke out between Armenia and Azerbaijan over disputed territories along the frontier, lasting from 1918 to 1920, focussing on the disputed areas of Nakhchivan (under the control of the short-lived 'Republic of Aras'), Zangezur and Nagorno-Karabakh.