“If it is China, then I think it’s important for the public to know that,” said Alex Joske, a researcher at the International Cyber Policy Center in Canberra. “Discussions about Huawei and influence will be issues during the election, and letting the public know that the Chinese Communist Party was in our system is important knowledge.”

Mr. Joske said Russia, which interfered in the 2016 United States presidential election, had less interest in the Australian election.

After the American experience in 2016, Western democracies should be increasingly aware of the vulnerability of their institutions, said Roderick Jones, founder and president of the cybersecurity firm Rubica in San Francisco.

“It is gross negligence to have any significant breach of a system at this point, given everything that’s happened around the world, to have a penetration of a parliamentary system is just negligent,” he said.

The Australian hack was above all designed to damage voter confidence, Mr. Jones said.

“People are suddenly questioning electronic voting, some of those processes get brought into focus and people stop having trust in them. Every Western election has had interference, every one has been damaged in some way. Russia and China are more allied than ever to destroy confidence in the system,” he said.

The prime minister’s acknowledgment of the hack represented a departure from past policy, in which the government has been reluctant to single-handedly call out cyberattacks by foreign governments. Last April, Australia, the United States and Britain accused Russia of state-sponsored hacking. In December, Australia followed the United States in condemning Chinese hackers for trying to steal intellectual property.

The Australian government’s conundrum now is what it will do once it has uncovered the identity of the foreign state actor, said Fergus Hanson, head of the International Cyber Policy Center.