Following the surrender of Japan, Indonesia proclaimed its independence on 17 August 1945. The final stages of warfare were initiated in October when, under the terms of their surrender, the Japanese tried to re-establish the authority they relinquished to the Indonesians in towns and cities. The fiercest fighting involving the Indonesian "pemuda" and the Japanese was in Semarang. In a few days, British forces began to occupy the city, after which retreating Indonesian Republican forces retaliated by killing between 130 and 300 Japanese prisoners they were holding. Five hundred Japanese and 2,000 Indonesians had been killed, and the Japanese had almost captured the city six days later when British forces arrived.