Philippine commandos, helped by U.S. security officials, stormed a commercial airliner in a practice exercise—but they did not tell most of the civilian participants that it was just a drill, the Philippine Defense Ministry confirmed Tuesday.

Special forces from the Philippine military performed the exercise last week, aided by U.S. information and guidance.

The drills took place in Hawaii and at a former U.S. air base outside Manila. 

For dozens of passengers, their worst nightmares appeared to have come true: The Islamic State militant group (ISIS) had apparently hijacked their plane. But it was all planned by Washington and Manila as part of “Tempest Wind”—a series of bilateral counterterrorism drills between the two countries.

In total, 1,200 Philippine and American personnel and civilians took part in the drill. 

The majority of the Philippine civilian contingent were told that the plane, flying from Sydney to Honolulu, had been taken by eight ISIS fighters, and would land at Clark Air Base, northwest of the Philippine capital, Manila, on Luzon Island. 

"Many of the participants were unaware of the drill until the last minute, thinking the hijacking was for real," Defense department spokesman Arsenio Andolong told reporters, according to Reuters.

"The drill gave both sides valuable lessons on dealing with such crisis," Andolong said. "There were many operational and tactical gaps discovered. Even the U.S. found some of its protocols did not work the way it is expected.”

Several of the 182 passengers of the flight were technically killed in the hijack simulation, and Philippine negotiators had to talk with the hijackers for almost 72 hours, before storming the airliner to “neutralize” the hijackers.

Defense Secretary Delfin Lorenzana said the drill "was designed to provide realistic scenarios on terrorism that demanded both high-level engagements and responses on tactical level." 

The Philippines is battling a jihadi insurgency in its Muslim-majority south, led by two radical Islamist factions known as the Maute group and Abu Sayyaf, both of which have pledged allegiance to ISIS.

Militants aligned with the world’s most notorious extremist group stormed the city of Marawi, which had a pre-battle population of around 200,000, in May, capturing key areas of the city. The battle is ongoing with dozens of jihadis still holed up in buildings under siege by the Philippine military. 

The U.S. military is providing technical assistance to Manila in its bid to retake the city, in what has been the biggest land grab by an ISIS affiliate in Asia—one that has taken the lives of hundreds of militants and Philippine soldiers.

Evidence has surfaced indicating the jihadis besieging the city are not simply acting on the inspiration of ISIS, but that the group’s central command in Syria has been funneling funds to Southeast Asian militants to help the offensive.

Last month, Philippine President Rodrigo Duterte appeared on the front lines of the battle, firing a sniper rifle at the militants in a bid to show solidarity with his troops in what was a public act of force. A government statement said that Duterte “tried a sniper rifle and fired twice toward the direction of the terrorists.” 

The joint drill was the latest in a long defense partnership between Washington and Manila. The U.S. have given hundreds of millions to the Asian country in the past two decades to boost its security forces.

But Duterte has railed against U.S. criticism of his war on drug gangs and criminal networks, which has included extrajudicial executions, according to rights groups. The Philippine president said in October 2016 that he would review a U.S. defense cooperation deal signed in 2014 that allowed American troops access to several bases in the Philippines for humanitarian and disaster response operations and maritime security. 

Duterte launched furious tirades at the Obama administration, calling President Donald Trump’s predecessor a “son of a whore” and expressing his disdain for the military relationship. But with Trump’s entrance into the White House, he has “accepted the situation at this stage,” and that his country may require U.S. assistance, the presidential spokesperson Ernesto Abella said in June.