Two people died, along with an Islamist gunman, after commandos stormed a cafe in Sydney, Australia, to bring to an end a 16-hour siege.
Local media have named those who died as Lindt cafe manager Tori Johnson, 34 and lawyer Katrina Dawson, 38.
Four people were injured, including a policeman hit by shotgun pellets.
Central Sydney was put in lockdown as the gunman, identified as an Iranian refugee, seized dozens of hostages early on Monday.
The Lindt Chocolat Cafe is located in Martin Place, a busy shopping area in Sydney's financial district.
The gunman, named as Man Haron Monis, forced some of the hostages to hold up a black Islamic banner at the window of the cafe.
Monis received political asylum in Australia in 1996 and was on bail facing a number of charges.
Prime Minister Tony Abbott said the "horrific incident" at the cafe had been "tragic beyond words" and there were "lessons to be learned" from this "brush with terrorism".
"These events do demonstrate that even a country as free, as open and as generous as ours is vulnerable to acts of politically motivated violence but they also demonstrate that... we are ready to respond," he told reporters.
Flags are to fly at half-mast across New South Wales to honour the victims.
A 34-year-old man and a woman aged 38 were pronounced dead after being taken to hospital, as was the gunman, the New South Wales police force said in a statement.
Two women suffered non-life threatening injuries as did a policeman who had been hit in the face by pellets.
Another woman suffered a gunshot wound to her shoulder.
Swiss chocolate-maker Lindt, the owner of the cafe, said in a statement: "We are devastated by the loss of their lives and that several others were wounded and had to experience such trauma."
New South Wales state police commissioner Andrew Scipione said it had been an "isolated incident".
Seventeen hostages were accounted for, including those who had managed to escape earlier, he said.
Local media reports suggest the commandos from the Royal Australian Regiment entered the building after the gunman started firing shots.
Commissioner Scipione urged people not to "speculate" about what had happened inside the cafe and said police believed more lives could have been lost if officers had not entered the cafe at that point.
09:45 Monday local time (22:45 GMT Sunday): Police are called out to the Lindt Chocolat Cafe in Sydney's Martin Place, a busy plaza in the heart of the city. Suggestions an armed robbery is under way are soon discounted
10:09: Australian TV stations broadcast footage of hostages holding a black Islamic banner up to the window. The gunman can also be seen, wearing a bandana
12:30: As police flood the area, Prime Minister Tony Abbott goes on national TV to promise a thorough police response to the "deeply concerning incident"
16:00-17:00: Three men, then two women, sprint to safety from the cafe's fire exit
18:30: Police confirm negotiations are under way with the gunman
02:20 Tuesday (15:20 GMT Monday): Several more hostages escape and commandos storm the cafe
02:48: Police officially confirm end of siege. They later report the deaths of three people, including the gunman
Several hostages fled from the building shortly after 02:00 local time Tuesday (15:00 GMT Monday),
Minutes later, the commandos with assault rifles and wearing helmets and body armour could be seen running into the cafe, tossing stun grenades ahead of them, as shots were heard.
Hostages ran to safety with their hands in the air. The dramatic scenes of the rescue operation were broadcast live on television.
Five hostages had also managed to escape through a fire exit on Monday afternoon.
Monis was on bail for being an accessory to the murder of his ex-wife. He also faced more than 40 sexual and indecent assault charges.
He had also been convicted of sending offensive letters to the families of deceased Australian soldiers.
The self-styled cleric, who described himself on a website as a Shia Muslim who had converted to Sunni Islam, was said by his former lawyer to have been an isolated figure.
One of the gunman's demands was to have a flag of Islamic State, the Sunni militant group which recently seized territory in Syria and Iraq, delivered to the cafe.
Prime Minister Abbott said the gunman had had an "infatuation with extremism" and had been mentally unstable.
He had "sought to cloak his actions with the symbol of the ISIS [IS] death cult," Mr Abbott added.
Martin Place is home to the state premier's office and the headquarters of major banks.
At the nearby Sydney Opera House, evening performances were cancelled as shops and offices in the area shut early due to the security situation.
"It's sad to think this is my home and that it could happen anywhere," onlooker Rebecca Courtney told AFP news agency.