This article begins highlighting the permanent unrest of the Pre-Columbian people. Nevertheless, its main object is the war from the Spanish Conquest to the Independence in 1821. Analyzes the military transformations in the Isthmus since 1597, after the first fortifications in Portobelo and the river Chagres, the creation of the first regular troops and ordinary militia, and highlights the great importance of the militia in the defense. It analyzes the creation of the situado in 1664 and its impact in the economy, and the transformation of the ordinary militia to disciplinary militia en 1773. It documents military conflicts between Panamanian troops against foreign invading forces showing that, against the traditional interpretation, several times the local forces defeated the invaders.