SYDNEY, Australia — The Australian police arrested five men on Saturday who they said had been planning terrorist attacks to be carried out next weekend, during a national holiday. Prime Minister Tony Abbott said the men had been inspired by the Islamic State extremist group.

The police said they believed that two of the men, both 18, had been preparing to attack police officers in Melbourne, Australia’s second-largest city, during the Anzac Day holiday on April 25. Anzac Day honors the landing of troops from the Australian and New Zealand Army Corps on the Gallipoli Peninsula in Turkey during World War I. This year is the centennial of the landing, and large-scale public commemorations are planned for next Saturday, Sunday and Monday.

“We believe that the potential attack was inspired by the Daesh death cult in the Middle East,” Mr. Abbott said at a news conference here hours after the arrests. Daesh is an Arabic acronym for the Islamic State group, also known as ISIS or ISIL, which controls territory in Iraq and Syria.

The arrests followed raids early Saturday on several residences in Melbourne by about 200 police officers.