The islands were liberated by U.S. forces in 1944–45, and the Republic of the Philippines was proclaimed in 1946, with a government patterned on that of the U.S. In 1965 Ferdinand Marcos was elected president. He declared martial law in 1972, which lasted until 1981. After 20 years of dictatorial rule, Marcos was driven from power in 1986.