Romania had been allied with the Central Powers since 1882. When the war began, however, it declared its neutrality, arguing that because Austria-Hungary had itself declared war on Serbia, Romania was under no obligation to join the war. When the Entente Powers promised Romania Transylvania and Banat, large territories of eastern Hungary, in exchange for Romania's declaring war on the Central Powers, the Romanian government renounced its neutrality. On 27 August 1916, the Romanian Army launched an attack against Austria-Hungary, with limited Russian support. The Romanian offensive was initially successful, against the Austro-Hungarian troops in Transylvania, but a counterattack by the forces of the Central Powers drove them back. As a result of the Battle of Bucharest, the Central Powers occupied Bucharest on 6 December 1916. Fighting in Moldova continued in 1917, resulting in a costly stalemate for the Central Powers. Russian withdrawal from the war in late 1917 as a result of the October Revolution meant that Romania was forced to sign an armistice with the Central Powers on 9 December 1917.. How many years after Romania had been allied with the Central Powers did they launch an attack against Austria-Hungary?