Prime minister Malcolm Turnbull has declared a siege in which two men were killed, three police officers were injured and a woman was taken hostage as a terrorist attack.
"This terrorist attack by a known criminal, a man who was only recently released on parole, is a shocking, cowardly crime," Turnbull told reporters on Tuesday morning.
The gunman was shot dead following a stand-off with police in the Melbourne suburb of Brighton on Monday.
"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," the prime minister said.
"What is clear here is that we face a growing threat from Islamist terrorism in Australia, in our region and around the world."
Victoria Police said the gunman was killed by officers in the Bay Street apartment complex shortly before 6pm.
In a statement, police said a woman who was being held against her will was rescued.
Victoria Police chief commissioner Graham Ashton said the woman was an escort who had been booked by the gunman.
“We understand he’s arranged to meet her as part of an escort service and booked her services and met her there for the purposes of those services with the escort agency,” Ashton said on Tuesday morning.
"During that time that this individual was inside this apartment, there was a call made to Channel Seven, making claims around the fact that what he was doing was for ISIS."
Just before 4pm on Monday another man, who police have confirmed was an Australian national born in China, had been found dead in the lobby of the apartment building with a gunshot wound.
"[It is] a great tragedy that he's now deceased at the scene, not believed to be connected other than the fact that he's worked at the apartments” Ashton said.
The gunman, who police have identified as 29-year-old Somali national Yacqub Kharyre, arrived at the building and fatally shot the man, who was working in the foyer of the apartments, before holding the escort hostage.
He then came out of the apartment with a shotgun and fired at police.
Ashton confirmed three police officers sustained non-life-threatening injuries from the gunfire.
"Two were injured in the hand and one was injured in the neck and ear areas... fortunately they were OK. Two of them are still in hospital. One was treated at the scene."
Khayre was fatally shot by police "at the scene", Ashton said.
The commissioner confirmed that Khayre was on parole at the time of offence.
Ashton said there was nothing that indicated the incident was premeditated or planned.
"We believe at this stage from the information we have that he was acting alone and there isn't a sort of ongoing threat in relation to any plot or anything around this individual."
Police were treating the incident as a "terrorism incident", he said.
"We're aware of [Islamic State] having claimed responsibility, but then they always tend to jump up and claim responsibility every time something happens, so we note that that has happened, but he's also made statements last night around Al-Qaeda."
The gunman was not someone who had "been a major concern in relation to terrorism aspects", Ashton said.
The man had come to Australia from Somalia as a young child and was an Australian citizen.
Islamic State's news service claimed the group was responsible for the attack.
“The attack in Melbourne, Australia was carried out by a soldier of the Islamic State in response to the call for targeting the subjects of the coalition states,” the group’s Amaq news agency said.
At the press conference on Tuesday morning, Turnbull asked: “How was this man on parole?”
“He had a long record of violence. A very long record of violence," the prime minister said.
“He had been charged with a terrorist offence some years ago and had been acquitted.
“He was known to have connections, at least in the past, with violent extremism.”
Victorian deputy police commissioner Shane Patton updated reporters on the situation late on Tuesday afternoon.
Patton said one of the police officers had been injured by a "number of pellets" in his face that would "require an operation" and another had a "very serious injury to her hand" that would also require surgery.
He said the weapon was a "sawn-off shotgun" and shed more light on the identity of the victim and hostage.
"The hostage was a 36-year-old female. A Columbian national. She was not physically injured but as been very significantly traumatised from this event as you would expect."
Patton said the slain receptionist was recently married and was a father.
Richard James is acting head of news for BuzzFeed Australia and is based in Sydney.
Contact Richard James at firstname.lastname@example.org.
Gina Rushton is a breaking news reporter for BuzzFeed News and is based in Sydney.
Contact Gina Rushton at email@example.com.
Got a confidential tip? Submit it here.