After embarking on back-to-back trips to China and Russia, Philippine President Rodrigo Duterte was suddenly to confront a festering crisis in his home island of Mindanao. Barely a day into his high-profile visit to Moscow, the Filipino President was informed about a daring assault by an ISIS affiliate group on the Muslim-majority city of Marawi.
As the crisis deepened - with the extremist Maute group, also known as the Islamic State of Lanao, rampaging across the city - Mr Duterte was forced to cut short his overseas visit and decided to declare martial law all across Mindanao. He still managed to arrange an earlier-than-scheduled meeting with Russian President Vladimir Putin.
Subsequently, the two countries signed a package of agreements, including on defence cooperation and intelligence sharing, with specific focus on counter-terrorism.
As extremist elements and transnational militant groups like the Islamic State in Iraq and Syria (ISIS) make inroads into the Philippines, Mr Duterte will be under growing pressure to patch up differences with tried-and-tested allies like Washington, which has been a reliable partner in counter-terrorism over the decades.
The siege of Marawi was likely an opportunistic revenge attack after the Philippine military failed to capture Isnilon Hapilon, the leader of the Abu Sayyaf group, in a botched raid operation. Hapilon, who is on the United States Federal Bureau of Investigation's most wanted list, has been designated as the emir of ISIS affiliates in the Philippines by the ISIS command in the Middle East.
The Maute group was likely also emboldened by the fact that the President and almost all of his senior defence officials - including the defence secretary, national security adviser and military chief of staff - were thousands of miles away in Moscow to secure new defence deals.
A visibly alarmed Mr Duterte immediately raised the spectre of Marcosian authoritarianism by warning that his martial law proclamation will not "be any different from what President (Ferdinand) Marcos did" in the 1970s and 1980s, reminding everyone that he would similarly "be harsh" as the former strongman.
Mr Duterte provided no specific explanation as to why he placed the entirety of Mindanao - the Philippines' second largest and southernmost island - rather than just Marawi and surrounding areas, under martial law. Both the military Chief of Staff Eduardo Ano and Defence Secretary Delfin Lorenzana have questioned the necessity for invoking draconian emergency measures, arguing that the situation is under the control of the armed forces of the Philippines.
The Filipino President, however, upped the ante by threatening to extend martial law beyond Mindanao, potentially suspending the writ of habeas corpus across the country. The 1987 Constitution of the Philippines, which was specifically designed to prevent the emergence of another strongman, places severe restrictions on the proclamation and execution of martial law by any Filipino president.
For instance, the Philippine Congress as well as the Supreme Court can question and quash any unjustified martial law declaration, which can last for only 60 days unless extended by an Act of Congress. Mr Duterte, however, could count on the support of his super-majority coalition in the legislature while openly threatening that he "will not listen to anyone else", even the Supreme Court.
Mr Duterte's allies in the Senate immediately struck down a resolution which called for the convening of both Houses of the Congress to examine the constitutionality of the martial law declaration across Mindanao. Fifteen out of 23 senators also filed a resolution to express their support for the President's latest measure.
The military, however, has sought to assuage concerns over the martial law declaration by releasing a set of guidelines aimed at upholding basic constitutional rights of the citizens in Mindanao. Defence Secretary Lorenzana told the author that the military "will not repeat the Marcos martial law abuses" and will continue to "safeguard the basic constitutional rights of the people of Mindanao".
The Philippine government argues that it is facing nothing less than an invasion - not just a rebellion - given the involvement of foreign fighters, possibly even from the Middle East, in the ongoing clashes in Marawi.
Government forces are slowly wresting back control of the besieged city, but it is increasingly struggling with a precarious urban warfare, which has resuscitated horrific memories of the Zamboanga siege by Islamist rebels in 2013. Back then, it took the Philippine military more than two weeks to return the situation to a semblance of normality.
Throughout his first year in office, Mr Duterte dedicated much of his political capital to a controversial war on drugs, which has been a bone of contention between the Philippines and Western allies. Now, however, the Philippine government is focused on soliciting maximum assistance from all potential partners, including rebel groups such as the Moro Islamic Liberation Front and the Moro National Liberation Front, to fight back against ISIS affiliates and bring peace to Mindanao.
In the coming months, Mr Duterte could consider resuscitating relations with Washington, which can provide high-grade intelligence and advanced equipment as well as boast decades of proven inter-operability with the Philippine military. The Filipino President might also need to reconsider an earlier threat to reject large-scale aid from the European Union, which has invested heavily in the peace process in Mindanao. Ultimately, domestic political challenges could force Mr Duterte to recalibrate his pursuit of an "independent" foreign policy away from traditional allies in the West.
• The writer is a political science professor at De La Salle University in the Philippines, and the author of Asia's New Battlefield: US, China And The Struggle For The Western Pacific.
• S.E.A. View is a weekly column on South-east Asian affairs.
We have been experiencing some problems with subscriber log-ins and apologise for the inconvenience caused. Until we resolve the issues, subscribers need not log in to access ST Digital articles. But a log-in is still required for our PDFs.