A radical Muslim cleric known for praising Osama bin Laden was charged with masterminding the plot.
One suspect was in critical condition after being shot in the neck during a gunfight with police, said police Commissioner Graeme Morgan. An officer was hit, receiving a minor graze to the hand.
A bomb squad robot examined a backpack the suspect was wearing when he was shot and found a hand gun, Morgan said.
"I'm satisfied that we have disrupted what I would regard as the final stages of a large-scale terrorist attack ... here in Australia," New South Wales Police Commissioner Ken Moroney said on Australian Broadcasting Corporation radio.
Prime Minister John Howard, who last week warned of a possible imminent terror attack in Australia, thanked security forces in a nationally televised news conference.
"This country has never been immune from a possible terrorist attack," he said. "That remains the situation today and it will be the situation tomorrow."
Abu Bakr, a leading Algerian-Australian cleric who has said that while the killing of innocents is wrong, he would be violating his faith if he warned his students against joining the jihad, or holy war, in Iraq, was among nine men who appeared this morning in Melbourne Magistrates Court charged with being members of a terror group.
Prosecutor Richard Maidment told the court the nine planned to kill "innocent men and women in Australia."
"The members of the Sydney group have been gathering chemicals of a kind that were used in the London Underground bombings," Maidment said, adding that Abu Bakr was the group's ringleader.
"Each of the members of the group are committed to the cause of violent jihad," he added, saying they underwent military-style training at a rural camp northeast of Melbourne.
Seven of the suspects, including Abu Bakr, were ordered detained until a court appearance on January 31. Two others are to hear tomorrow whether their application to be released on bail will be granted.
Seven men arrested in Sydney were held in cells at a tightly guarded downtown court during a five-minute hearing this afternoon at which they were ordered held until another hearing on Friday on charges of preparing a terror act by manufacturing explosives.
The eighth suspect, the man shot by police, was under guard in hospital and was not immediately charged.
Defence lawyer Adam Houda, who was representing at least one suspect, told reporters outside the court that the charges were a "scandalous political prosecution."
"There's no evidence that terrorism was contemplated or being planned by any particular person at any particular time or at any particular place," he said.
Federal Police Commissioner Mick Keelty said the fact that a suspect fired at police "serves to show that we are dealing with very serious issues here."
Angry supporters of the suspects clashed violently with news cameramen in Melbourne and Sydney.
More than 500 police backed up by helicopters hovering overhead were involved in raids across Sydney and Melbourne, arresting eight men in Sydney and nine in Melbourne and seizing chemicals, weapons, computers and backpacks.
Moroney said possible bomb-making materials were found, including chemicals which, "when combined in combinations of one or more, certainly could be highly volatile."
Police declined to give details of the likely target of the attack, but New South Wales Police Minister Carl Scully said: "I was satisfied that this state was under an imminent threat of potentially a catastrophic terrorist act ... involving the attempted stockpiling of chemicals and related materials that could be used in a major explosion."
Melbourne lawyer Rob Stary said he represented eight of the Melbourne suspects including Abu Bakr, who in the past has called al-Qa'ida mastermind Osama bin Laden a "great man." Abu Bakr leads a fundamentalist Islamic group in the southern city of Melbourne where he has lived since 1989.
Australia has never been hit by a major terror attack, but its citizens have repeatedly been targeted overseas, particularly in neighbouring Indonesia, where dozens of Australians have been killed in bomb blasts since 2002.
Last week, Howard rushed through Parliament an amendment to terror laws he said would beef up police powers to arrest suspects plotting attacks. Melbourne police said the new powers helped them carry out their raids.
Opponents say Howard's strong support for the US-led strikes on Iraq and decision to send troops there and to Afghanistan have made it inevitable Australia will be attacked.Reuse content