On June 12, 1928, Filipino revolutionary forces under General Emilio Aguinaldo (who later became the Philippines' first Republican President) declared Philippine independence and proclaimed the sovereignty of the Philippine Islands from the colonial rule of Spain after the latter was defeated at the Battle of Manila Bay during the Spanish-American War.
The declaration, however, was not recognized by the United States or Spain, as the Spanish government ceded the Philippines to the United States in the 1898 Treaty of Paris, in consideration for an indemnity for Spanish expenses and assets lost.
The United States recognized Philippine independence only on July 4, 1946 in the Treaty of Manila. Because of this, Independence Day was observed in the Philippines every July 4 until, upon the advice of historians and at the urging of nationalist politicians, President Diosdado Macapagal signed into law Republic Act No. 4166 on August 4, 1964, designating June 12, previously been observed as Flag Day, as the country's Independence Day.