The siege at the Sydney cafe had been going on for more than five hours and 82-year-old John O'Brien had become convinced the gunman was insane and they would likely all end up dead.

And so he made a decision, one he knew came with a cost: he was going to try to escape.

O'Brien — a former professional tennis player who played at Wimbledon — looked at the gunman who was at the other end of the cafe, barricaded behind tables and chairs. The man had forced two or three young women to stand in front of him as human shields, so police snipers couldn't take shots at him.

O'Brien glanced up at Stefan Balafoutis, a lawyer, who was standing, as ordered, with his hands against the window. The younger man had his eyes closed.

"I said to the barrister, look, this is not going to end well, this guy will never get out of here alive, and he's going to take everyone with him," O'Brien told The Associated Press in the first detailed account from a hostage who was held inside the cafe.

He whispered his plan to Balafoutis. The lawyer replied: "Good idea."

O'Brien was exhausted and was wondering at times if he was in a dream. He hadn't eaten since early in the morning, before their ordeal began, when he'd ordered a piece of raisin toast and a cappuccino.

He thought the coffee at the Lindt Chocolat Cafe in Martin Place was creamy and delicious, albeit overpriced. He liked the chocolates on display, a point of difference at the cafe. He'd visit a few times a year, often after an appointment with his eye doctor like the one he'd had that morning.

O'Brien was eating his toast when 50-year-old Man Haron Monis strode in, wearing a bandanna with Arabic writing. He pulled out a shotgun. O'Brien looked at it, thinking it was the size of a tennis racket. He knew right away the situation was dire. The gunman grabbed Tori Johnson, the 34-year-old cafe manager, ordering him to lock the door. O'Brien said Monis was immediately aggressive and belligerent.

There were 17 people in the cafe that Monday who became the gunman's hostages. Several were cafe staff in their early 20s. The customers included three lawyers and four bank workers who had popped in from nearby offices. O'Brien was the oldest while Jarrod Hoffman, a 19-year-old university student and a cafe staffer, was the youngest.

Monis ordered the customers to stand with their hands on the cafe window and to hold up a black Shahada flag with the Islamic declaration of faith written on it. O'Brien said he stood with his hands on the window for 30 minutes, or maybe 45 — it was hard to tell — before telling the gunman how old he was and saying he needed to sit down.

It was his first challenge to the gunman's authority and a bit of a ruse, he said. He felt stronger than he was letting on. He's remarkably fit for his age. He still plays competitive tennis, and is among the best in Australia in his age group. As a young man, in 1956, he made it to the fourth round of Wimbledon.

Monis complained but relented, allowing O'Brien and a few others to sit.

The hours ticked by as the gunman tried to use the hostages to relay his odd demands on social media: to be delivered a flag of the Islamic State group and to speak directly to Australian Prime Minister Tony Abbott.

O'Brien would sometimes rest his head on the table. He thought about his wife, Maureen, whose brother had died two weeks earlier. He thought about his two daughters. And he thought about the gunman, who he became convinced was mad.

O'Brien quietly slipped out of his seat and sat on the floor. He'd noticed a small gap between the wall and a large advertising placard, which was perhaps 10 feet (3 meters) wide and 5 feet (1.5 meters) high. He figured the gap was less than a foot (0.3 meter) wide but he knew he had to squeeze through if his plan was to work.

He struggled, trying several times and failing. Finally, he made it through. Now the placard was obscuring him from the gunman. He lay down, looking up at a large green button. But he wasn't sure if it would open the glass doors. If the button didn't work, he figured, he would be seen by the gunman and killed.

Also weighing on his mind was the thought of leaving the others behind. He didn't want to, of course, and he had no way of knowing how the gunman might react.

"I was terribly worried for them," he said.

But there was no turning back. He reached up and pushed the green button and a moment later, at 3:37 p.m., he was free.

The images of O'Brien running toward the police in his blue blazer, glancing back with Balafoutis close behind, were played around the world. The men put their hands in the air as they reached the heavily clad officers. O'Brien took a step back out into the street, gesturing back toward the cafe, before an officer pushed him behind the front line and to safety.

Over the following hours, several more hostages escaped. The siege ended just after 2 a.m. in a barrage of gunfire when police rushed in to free the remaining captives. Two hostages, including Johnson, the cafe manager, were killed. So was the gunman.

Johnson would be hailed a hero, after reports he brought the standoff to an end by wrestling Monis for the shotgun, saving the lives of most of his fellow hostages.

O'Brien certainly considers Johnson a hero. He says he can't sleep and he can't stop thinking about Johnson and the other victim, Katrina Dawson, a 38-year-old mother of three.

"They weren't doing anything wrong," he said.