Roads emptied and people were ordered to stay indoors in parts of Taiwan, including its capital Taipei, on Monday for an air-raid exercise as the island steps up preparations in the event of a Chinese attack.
Sirens sounded at 1:30 p.m. (0530 GMT) for the mandatory street evacuation drills, which effectively shut towns and cities across northern Taiwan for 30 minutes.
A "missile alert", asking people to evacuate to safety immediately, was sent via text message.
"It is necessary to make preparations in the event of a war," Taipei mayor Ko Wen-je said in a speech after overseeing drills for the exercise named Wan An, which means everlasting peace.
China claims democratically ruled Taiwan as its territory and has never ruled out taking the island by force. Taiwan rejects China's sovereignty claim and vows to defend itself.
Russia's invasion of Ukraine has renewed debate in Taiwan about how best to react in the event of an attack amid stepped up Chinese military manoeuvres around the island.
"Chinese military planes have frequently harassed Taiwan in recent years and there's even the outbreak of the Russia-Ukraine war in February, these incidents remind us that we need to be vigilant in peace time," Ko said.
In Taipei, police directed vehicles to move to the side of the road and passersby were told to seek shelter. Shops and restaurants pulled down their shutters and turned off lights to avoid becoming a target in the event of a night-time attack.
Firefighters practised putting out a fire triggered by a missile attack.
Sirens sounded 30 minutes later to give the all-clear.
Concern about China's intentions towards Taiwan has added to tension with the United States, which, while it does not recognise the island as a separate country, is bound by U.S. law to provide it with the means to defend itself.
China confirmed that it did heighten warnings to the Biden administration about U.S. House Speaker Nancy Pelosi's possible visit to Taiwan, as first reported by the Financial Times, a foreign ministry spokesman said on Monday.
Spokesman Zhao Lijian also said at a daily media briefing that the Chinese side will take "forceful" measures if the visit goes ahead.
Periodic air-raid drills are required by law in Taiwan.
The island has raised its alert level since the Russian invasion of Ukraine even though it has reported no unusual Chinese military activity.
Other parts of Taiwan will carry out street evacuation drills this week. The exercise had been cancelled for the past two years because of COVID-19.
Taiwan President Tsai Ing-wen has made boosting defence capacity her top priority and said only its people can decide their future.
"When everyone receives the text message, do not panic," Tsai said in a reminder to the public on Facebook early on Monday. "Citizens, please evacuate according to the guidance."