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 declared war on Serbia, Romania was under no obligation to join the war. On 4August 1916, Romania and the Entente signed the Political Treaty and Military Convention, that established the parameters of Romania's participation in the war. In return, it received the Allies' formal sanction for Transylvania, Banat and other territories of Austria-Hungary to be annexed to Romania. The action had large popular support. On 27 August 1916, the Romanian Army launched an attack against Austria-Hungary, with limited Russian support. The Romanian offensive was initially successful in Transylvania, but a Central Powers counterattack drove them back. As a result of the Battle of Bucharest, the Central Powers occupied Bucharest on 6December 1916. Fighting in Moldova continued in 1917, but 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 9December 1917.