SYDNEY

- The deadly siege began in the most incongruous of ways, on a sunny Monday morning inside a cheerful cafe in the heart of Australia's largest city. An Iranian-born gunman burst in, took 17 people hostage, and forced some to hold a flag with an Islamic declaration of faith above the shop window's festive inscription of "Merry Christmas."

It ended after midnight with a barrage of gunfire that left two hostages and the gunman dead, four others wounded, and a nation that has long prided itself on its peace rocked to its core.

After waiting 16 hours, police decided to storm the Lindt Chocolat Cafe early today when they heard gunfire inside, said New South Wales state police Commissioner Andrew Scipione.

A loud bang rang out, several hostages ran from the building and police swooped in amid heavy gunfire, shouts and flashes. A police bomb disposal robot also was sent into the building, but no explosives were found.

"They made the call because they believed that at that time, if they didn't enter, there would have been many more lives lost," Scipione said.

The gunman was identified as Man Haron Monis, 50, who once was prosecuted for sending offensive letters to families of Australian troops killed in Afghanistan.

Prime Minister Tony Abbott said Monis had "a long history of violent crime, infatuation with extremism and mental instability."

Scipione wouldn't say whether the two hostages who were killed - a 34-year-old man and a 38-year-old woman - were caught in cross-fire, or shot by their captor. Among the four wounded was a police officer shot in the face.

"Until we were involved in this emergency action, we believe that no one had been injured. That changed. We changed our tactic," he said.

An investigation into the incident was underway.

Officials rolled one gurney out of the cafe carrying what appeared to be a man draped in a blood-soaked sheet with a bloody handprint in the center. Paramedics also carried away a woman with blood-covered feet.

"I can only imagine the terror that they've been through," Scipione said. "They are very brave people who in many cases were just buying a cup of coffee and they got caught up in this dreadful affair. We should reflect on their courage."

The prime minister also reflected on how an ordinary day turned terrifying.

"There is nothing more Australian than dropping in at the local cafe for a morning coffee, and it's tragic beyond words that people going about their everyday business should have been caught up in such a horrific incident," Abbott said.

While Monis' motivation for the attack was still unclear, Abbott confirmed he was "well-known" to state and federal authorities.

Last year, he was convicted and sentenced to 300 hours of community service for using the postal service to send what a judge called "grossly offensive" letters to families of soldiers killed in Afghanistan between 2007 and 2009.

At the time, Monis said his letters were "flowers of advice," adding: "Always, I stand behind my beliefs."

Monis later was charged with being an accessory to the murder of his ex-wife. Earlier this year, he was charged with the sexual assault of a woman in 2002. He has been out on bail on the charges.