Section 9. The President shall be commander-in-chief of all armed forces of the Philippines and, whenever it beĀcomes necessary, he may call out such armed forces to prevent or suppress lawless violence, invasion, insurrection, or rebellion. In case of invasion, insurrection, or rebellion, or imminent danger thereof, when the public safety requires it, he may suspend the privilege of the writ of habeas corpus, or place the Philippines or any part thereof under martial law.