TAIPEI (REUTERS) - Taiwan's defence minister apologised and said he was willing to resign after a coronavirus outbreak on a navy ship which visited the Pacific last month, just as the island celebrated a huge drop in cases.

A total of 27 sailors are confirmed to have been infected so far. They were on a friendship visit by three Taiwanese navy ships to the Pacific island state of Palau, one of only 15 nations that have formal diplomatic ties with Taiwan.

Defence Minister Yen Teh-fa, speaking at a news conference, offered his apologies to the public for the outbreak and took a deep bow, flanked by senior officers.

"I have asked President Tsai for punishment, and the president has asked the Defence Ministry to face the incident honestly and reflect thoroughly," Mr Yen said, adding that he would accept any punishment, including being asked to resign.

President Tsai Ing-wen, in a Facebook post, appeared to rule out sacking Mr Yen immediately, saying an investigation into the incident should be completed first before anyone is punished.

Mr Yen said disease prevention work was carried out before the ships set off but there were "shortcomings" and some disease control measures were not properly implemented. "Those who should be punished will be punished," he added.

The government is working to trace thousands of people in Taiwan who may have had contact with about 700 sailors on the Palau mission who disembarked in Taiwan before the coronavirus cases were confirmed.

Taiwan's Centres for Disease Control has sent some 200,000 text alerts via mobile phones to people who might have been in contact with the sailors.

Before announcing the navy infections on Saturday, Taiwan had marked three days with no new cases. Some buildings in Taipei had been lit up with the word "zero" in celebration.

Related Story Taiwan's medical staff voice concerns in spite of highly praised coronavirus outbreak prevention measures

Related Story Coronavirus explainers: What you should know to protect yourself

Related Story Coronavirus visual guide: Interactive graphics on the pandemic

The incident is also embarrassing for Taiwan as it has made a big show of aiding its diplomatic allies in fighting the virus, with gifts of face masks, and in Palau's case, helping with testing suspected cases.

Tiny Palau has no confirmed cases. Its government said this week there was no cause to panic about the Taiwan navy cases as there was "little chance that the virus on the vessels came from Palau".

Taiwan has been relatively successful dealing with the coronavirus, thanks to early detection and prevention measures, and has reported 425 cases and six deaths to date, far lower than many of its neighbours. A total of 217 people have recovered.