For decades, the Armed Forces of the Philippines (AFP) has been fighting internal security threats from small Maoist-led guerrillas and Muslim secessionist rebels, and much later, with a handful of al Qaeda and Islamic State-inspired Islamist militants.

In short, the military functioned as a constabulary unit, a gendarmerie-type police force of the country, capable of handling peace and order and not to fight an external threat.

It was trained, equipped, and oriented to fight and defeat dissidents but it took more than half a century to break the Communist New People’s Army’s backbone as conditions for rebellion remained — poverty, inequality, injustice, and lack of education and opportunities in poor, rural areas.

The country’s military was first organized during the last days of the Spanish colonial period as a revolutionary force to win the country’s independence from three centuries of colonization.

It did not last long; the Americans dismantled it after the capture of its generals, like Miguel Malvar, Artemio Ricarte, and Emilio Aguinaldo.

In 1901, the Americans organized the Philippine Constabulary (PC) to help the US military pacify the country from Filipino hold-outs, like Macario Sakay who was last leader of the American-Filipino war.

He was executed in 1906, ending Filipino insurrection after Spain ceded the Philippines to the United States.

In 1905, the US opened a Philippine Constabulary school in Intramuros to train Filipinos to command the insular force.

In 1908, that school was transferred to Baguio City and became known as Philippine Constabulary Academy.

It was later renamed to Philippine Military Academy in 1936 when the Commonwealth government organized an army to prepare for a war five years later.

Filipinos tasted combat against a foreign armed forces from Japan that had conscripted Koreans and Taiwanese to the invading force.

After the war, the army was sent to the Korean peninsula to fight alongside the US and its allies in repelling invasion from China backed-Communist North Koreans.

The military saw action in the Vietnam war but as part of a civil action group to win the hearts and minds of the Vietnamese.

There was actually little combat experience but the air force had some experience fighting in the Congo in the 1960s under the United Nations.

But the army was used to defeat the Communists — the Huks who were transformed from guerrillas fighting the Japanese into a peasant army fighting wealthy landlords.

Later, Ferdinand Marcos Sr used the military to fight a reorganized Maoist-led guerrillas and Muslim rebels in the south.

He paid little attention to external defense as he relied on the United States for its security umbrella.

The US has the two large overseas military bases in Subic and Clark projecting power in the region.

At the time, there was no real threat from China and North Korea and the Communist advance was contained in Indo-China.

Externally, there was little to worry but the domestic security situation was scary as the New People’s Army grew in numbers to about 25,000 during the last days of the Marcos regime.

There was also a real scare in 1974 when the Moro National Liberation Front (MNLF) was nearly captured in central Mindanao except the strategic PC Hill which was defended by then Brig. Gen. Fortunato Abat.

The MNLF was a formidable force supported by some Muslim countries, including Malaysia, which provided the guerillas sanctuary and training bases in Sabah.

Even after EDSA in 1986, the military was primarily an insular force trained and equipped to fight insurgency wars.

But the military was to shift to an external defense role when the Americans left in 1992 and China built a makeshift fishermen’s shelter on Mischief Reef in 1995.

The shift was painfully slow as the government employed the army to fight the NPAs and Muslim rebels in the south.

Even the United States was slow in helping the army develop into an external defense force as training and exercises from early 2000 focused on counter terrorism and humanitarian assistance and disaster relief (HADR) operations.

It was only when former president Benigno Aquino revived a 15-year military modernization program that the military leadership began to focus on external defense capabilities.

Under Gen. Eduardo Oban, the military started asking the US to provide them with precision-guided missiles and bombs, and explored ways to acquire shore-to-ship batteries to boost the country’s anti-access and area denial (A2AD) capabilities.

The US has started training the army, navy and air force on conventional warfare scenarios using advanced weaponry like HIMARS, Patriot and Javelin anti-tank missiles.

The military has also played catchup with its Southeast Asian neighbors in acquiring frigates, corvettes, multi-role fighters, radars, missiles, and even a submarine.

From 1901 when the Americans reorganized the Spanish Civil Guards into an insular constabulary unit, the Philippine military has gone a long way.

But it has to truly shift from internal security role to an external defense, acquiring modern equipment, re-orienting its doctrines and tactics as well as training to fight future wars against a more advanced adversary.