He wrote letters to the grieving families of troops killed in Afghanistan that compared them to "Hitler's soldiers." He was accused of assisting a woman kill his ex-wife, whose body was found stabbed and set alight.

But the social media postings of 50-year-old Man Haron Monis, the man who was killed Tuesday in a police operation to rescue 17 people he had held hostage in a Sydney cafe, indicate he thought of himself as something of a martyr. The self-styled Muslim cleric, who came to Australia as a refugee from Iran, complained of being tortured in prison for his political beliefs and said he was fighting for Islam and for peace.

"The more you fight with crime, the more peaceful you are," he wrote recently on his website, according to the SITE Intelligence Group. In another post he wrote: "I am one of the witnesses for the barbarism of the Australian government."

Monis was free on bail when he used a shotgun to take 17 hostages at the Lindt Chocolat Cafe Monday morning. He and two hostages died early Tuesday in a barrage of gunfire, when police stormed the cafe.

Australian authorities are now facing questions about why he was allowed out of jail given the seriousness of the charges against him.

"We are all outraged that this guy was on the street," New South Wales Premier Mike Baird said. "We need to ensure that everything is done to learn from this."

Prime Minister Tony Abbott called him a "deluded and sick individual" who was known to police and intelligence agencies but who was not on a terror watch list.

Monis, an Iranian refugee, was sentenced last year to 300 hours of community service for sending what a judge called "grossly offensive" letters to the soldiers' families between 2007 and 2009. The Australian newspaper said they included comparisons to Hitler.

He was also 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.

His former lawyer described him as a "damaged-goods individual."

"His ideology is just so strong and so powerful that it clouds his vision for common sense and objectiveness," Manny Conditsis told Australian Broadcasting Corp.

Exactly what that ideology was remains uncertain. Although he took an interest in the Islamic State group, his social media postings don't make clear his level of support for the group.

And the flag of Shahada that he had his hostages hang in the window of the cafe during his siege is a common expression of faith.

"This is a man who had serious history of criminal offences and a history of violence," Deputy Police Commissioner Catherine Burn told reporters. "This was a man that we do believe had some extremist views and we also believe that he was unstable."