SYDNEY — He wrote letters to grieving families of Australian troops killed in Afghanistan that likened them to "Hitler's soldiers." He was accused of being an accomplice in the murder of his ex-wife, who was stabbed and set on fire.

But the social media postings of 50-year-old Man Haron Monis, the man who was killed Tuesday in a police operation to rescue the people he was holding 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 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, including being an accessory to the murder of his former wife and sexually assaulting a woman in 2002.

"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 grew up in Iran as Mohammad Hassan Manteghi. In 1996, he established a travel agency but took his clients' money and fled, Iran's police chief, Gen. Ismail Ahmadi Moghaddam, told the country's official IRNA news agency.

Australia accepted Monis as a refugee around that time.

The police chief said Iran tried to extradite Monis in 2000, but that it didn't happen because Iran and Australia don't have an extradition agreement.

Lawyer Adam Houda, who represented Monis in 2009 after he had sent about eight letters to the families of slain soldiers, said Monis was one of his strangest clients. He said he would arrive wearing his robe and proceed to lecture his lawyer on the evils of the Middle East wars.

"He said he was a cleric, but he was not a cleric and nobody knew him," Houda said. "He had no affiliation with any groups, no affiliation with any mosque, he was just a lone wolf."

Houda said he considered Monis eccentric and passionate, but not dangerous, and that he thought he had a right to express himself, however distasteful his methods.

He said he decided to stop representing Monis after he refused to heed his advice not to talk to the media. Instead, Monis chained himself to the outside of the courthouse, waved signs and gave "crazy speeches" for hours, Houda said.

Last year, Monis was sentenced to 300 hours of community service for sending the letters, which a judge described as "grossly offensive" and which The Australian newspaper said referred to the fallen men as "Hitler's soldiers."

Another of his former lawyers described Monis as a "damaged-goods individual."

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

Exactly what that ideology was remains uncertain. Although Monis 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 the siege is a common expression of the Muslim faith. It was emblazoned with the Islamic declaration of faith, "There is no god but God and Muhammad is his messenger," one of Islam's five pillars of faith.

While holding the hostages, Monis made two strange demands: to be delivered an Islamic State flag and to speak directly with Australian Prime Minister Tony Abbott.

"This is a man who had serious history of criminal offenses and a history of violence," New South Wales state 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."