A fatal shootout claimed by the Islamic State group was being treated as a terrorist attack by Australian police Tuesday, as the prime minister condemned it as "shocking and cowardly".
A man of Somali background was killed in a gun battle with police when he opened fire following an hour-long standoff after taking a female escort hostage at a serviced apartment block in Melbourne on Monday evening.
It is alleged 29-year-old Yacqub Khayre, linked to a 2009 terror plot targeting an Australian army barracks, had first murdered a Chinese-born Australian man working as a receptionist in the foyer.
Police said he made statements "around Al-Qaeda" and called a local television station making similar comments, reportedly: "This is for IS, this is for Al-Qaeda."
Authorities labelled the attack as a terrorism incident but added that investigations were still ongoing into whether it was planned or random.
"We're not seeing anything indicating that he's got some message from overseas to do this at all but, again, early days," said Victoria Police chief commissioner Graham Ashton.
"We've got material that's seized. We'll go through that and work it out."
He said it was possible that Khayre may have been attempting to lure police by taking the escort -- reportedly a sex worker -- hostage.
"We still don't know exactly whether that was the case," Ashton said, but police believed he was acting alone and there was no ongoing threat.
The Amaq news agency -- which is affiliated with IS -- carried a statement claiming responsibility.
"The executor of the Melbourne attack in Australia is a soldier of the Islamic State and he carried out the attack in response to appeals to target citizens of coalition states," it said.
Ashton said IS "always tend to jump up and claim responsibility every time something happens" and it was too early to determine whether they were involved.
Authorities had responded to reports of an explosion at the building -- which turned out to be a gunshot -- in the affluent beach suburb of Brighton and arrived to find a dead body in the foyer.
"Subsequently he (Khayre) came out of the apartment with a shotgun and commenced to fire at police at the entryway to the apartments," Ashton said.
"He's exchanged gunfire with police and has been fatally shot by police at the scene."
The escort escaped unharmed but three police were wounded in the firefight, although their injuries were not life-threatening.
Prime Minister Malcolm Turnbull said the attack underlined the need to be constantly vigilant.
"This terrorist attack by a known criminal, a man who was only recently released on parole, is a shocking, cowardly crime," he said.
"It is a terrorist attack and it underlines the need for us to be constantly vigilant, never to be deterred, always defiant, in the face of Islamist terrorism."
Australian officials have grown increasingly concerned over the threat of extremist attacks.
They say they have prevented 12 attacks on home soil since the threat level was raised in September 2014, including a foiled Christmas Day plot in Melbourne last year, with more than 60 people charged.
But four have gone ahead, including the murder of a Sydney police employee in 2015 by a 15-year-old boy.
Khayre, whose parents were refugees from Somalia, was known to police and had a long criminal history.
He was charged and acquitted over a foiled plot to attack the Holsworthy Army barracks in Sydney in 2009.
Three of his co-accused were found guilty of planning the terrorist assault as payback for Australia's military action in the Middle East.
Khayre was released on parole late last year after serving time for intent to cause injury and arson, which Turnbull said was a concern given his background and something that would be reviewed.