The Philippines was a U.S. territory from 1898 to 1946. Between 1941 and 1946, during World War IIJapanese occupation, it remained a U.S. territory with a government in exile headed by Manuel Quezon initially located in Australia and later in the United States. A campaign to retake the country began in October 1944, when General Douglas McArthur landed in Leyte along with Sergio Osmena who had assumed the Philippine presidency after Quezon's death. The battles entailed long fierce fighting; some of the Japanese continued to fight until the official surrender of the Empire of Japan on September 2, 1945. The country gained complete independence on July 4, 1946.