Image copyright Marcia Resnick

John Wojtowicz was a romantic - he says that's why he tried to rob a bank to finance his lover's gender reassignment surgery. The failed robbery inspired the film Dog Day Afternoon and several documentaries, the latest of which, The Dog, is an affectionate, no-holds-barred portrait of a New York eccentric.

"Nobody would ever rob a bank to give a guy a sex-change operation, that's why they made a movie about it," says Wojtowicz in The Dog - the story of the man who committed one of the most sensational crimes the US has ever seen.

On 22 August 1972, John Wojtowicz and two accomplices, Salvatore Naturale and Bobby Westenberg walked into a Brooklyn branch of the Chase Manhattan bank, carrying shotguns - but immediately the raid went disastrously wrong.

Westenberg said he couldn't go through with it and walked out, the bank's safe turned out to be half empty, and one of the staff managed to raise the alarm. Soon the building was surrounded, and the eight staff had become hostages. The police set up shop in a beauty parlour across the road, and negotiations began.

Find out more Image copyright Josh Weinstein Allison Berg and Frank Keraudren spoke to Newshour on the BBC World Service. You can watch The Great Sex Addict Heist: The Dog at 22:00GMT on Wednesday 18 February on Storyville on BBC Four.

A rowdy audience of about 2,000 gathered to watch in the hot summer night - along with the FBI, emergency services, snipers on the roof and TV crews. "It was a circus," says journalist Bob Kapstatter in the film. "That was a Brooklyn crowd that night. It was a full-blown show."

Wojtowicz performed his role with a certain flair. He demanded food for the hostages, and paid the pizza delivery guy with wads of cash. He threw money at the onlookers. "Anyone would love him, this is Robin Hood," says Kapstatter, who worked for the Daily News.

Kapstatter and other journalists were able to call the bank and speak to Wojtowicz directly, and the increasingly bizarre drama was broadcast live to a city that hung on every word.

Two hours into the negotiations, Wojtowicz dictated his terms for the hostages' release: "I want them to deliver my wife here from King's County hospital. His name is Ernest Aron. It's a guy. I'm gay."

Image copyright NYPD

Wojtowicz said he was robbing the bank to pay for Aron's gender reassignment surgery. They had "married" the year before in a public wedding ceremony but Aron, who wanted a woman's body, had since become depressed and was in hospital following a suicide attempt.

"He was being honest - it was a big explosion. Gay liberation right down your throat," says Jeremiah Newton, a friend of Aron's, in the documentary.

He had been living in oblivion with his mother and he was just very happy that somebody would show up again and be interested Frank Keraudren, Film-maker

At that moment, Wojtowicz's first wife, Carmen Bifulco - a woman, and still his legal marriage partner - was on the beach with their two children, unaware that the robbery being carried out by an "admitted homosexual", as the news reports put it, was her husband's work.

Aron was duly brought to the scene, dishevelled and distressed, in a dressing gown, but refused to go over to speak to Wojtowicz. One person who did, though, was Wojtowicz's mother, Terry, who spent 13 hours at the scene.

Inside the bank, the hostages were hot, tired and frightened - although not particularly scared of Wojtowicz himself. In an archive interview used in the documentary Shirley Ball, the head teller, says: "I realised that he was friendly, he wanted to be friendly, he had a purpose for robbing the bank, he didn't think it would take that long, he thought he would be in and out - but the way things happened he didn't get out."

The siege lasted for 14 hours, ending only when the bandits were promised a flight abroad. An FBI agent drove them and their hostages to the airport but on arrival at JFK, Naturale was shot and killed, and Wojtowicz arrested. The hostages were freed, unharmed.

Wojtowicz was sentenced to 20 years in Lewisburg Federal Penitentiary, so when Sydney Lumet's movie, Dog Day Afternoon, came out in 1975, he was still in prison. He gave the money he got for his story to Aron, who finally had surgery and became Liz Eden. Wojtowicz was very proud of that. In a TV show broadcast shortly before his early release in 1978, he tells Eden: "I don't regret doing it because it saved your life."

New York film-makers Allison Berg and Frank Keraudren decided to track Wojtowicz down in 2002, and found him a compelling subject. "We were just curious about what the real-life guy would be like - would he be as outrageous, as charismatic as the person you see in Dog Day Afternoon?" says Berg. In fact he was "a hundred times more unusual and interesting and hilarious".

By then, Wojtowicz called himself The Dog, after Dog Day Afternoon, and revelled in his infamy. "By the time we met him he had been living in oblivion with his mother and he was just very happy that somebody would show up again and be interested," says Keraudren.

Image copyright Wojtowicz family Image caption John Wojtowicz and his mother, Terry

"He liked us because he knew we were self-financed and he thought we were New York City underdogs like him so he wanted to help. He even offered to rob a bank for us," says Berg.

It was the start of 10 years of filming. They spent every other weekend with The Dog and his mother, Terry, hanging out at their apartment, going on errands and accompanying them on many hospital visits. "It was our life for a decade. We were as close as you can be without being family," says Keraudren.

A few years into the project, Wojtowicz told them he had cancer. Characteristically, he refused treatment and died in 2006. "Up until the day before he died he was still making lecherous comments and asking for hamburgers that he couldn't eat because he was already so sick," says Berg. "But he never changed his ways."

Only then did Berg and Keraudren flesh out the story with other interviews - including his surviving wives. Liz Eden had died in 1987, from an Aids-related illness.

Carmen Bifulco, Wojtowicz's first wife, met him when they both worked for Chase Manhattan Bank. "Why don't you be my lucky bride of the future?" he asked her on their first date. "I thought the guy was crazy already," she says. They married in 1967, after his return from Vietnam, despite her family's disapproval. "To disappoint my in-laws, I lived through the war," he said.

Image copyright Bifulco family Image caption Carmen Bifulco and John Wojtowicz at their wedding in 1967

Image copyright Courtesy of Unleashed Films

But while in the military, Wojtowicz had discovered sex with men, and in 1969 the couple separated.

"Weddings to me, is a holy institution," he says in the film. "Love is a holy institution. If I love someone I want to marry that person. I want to make a commitment to that person. And in straight society you do that by getting married. So I don't see why gays can't do that."

Wojtowicz and Aron got married in style. Aron wanted - and got - the most expensive wedding dress in the shop - it cost almost $1,000 (£650). But the couple broke up after endless arguments about Aron's desire to have surgery. "I didn't want Ernie to have a sex change, but he wanted to be a woman," says Wojtowicz, who worried he would no longer be attracted to his partner. But when Aron was hospitalised after yet another suicide attempt, Wojtowicz saw his lover would never be happy without surgery and decided to raise the money - by robbing a bank.

Image copyright Rich Wandel Image caption John Wojtowicz and Ernie Aron at their wedding in December 1971

At the time, some questioned whether this was the genuine reason for the robbery, suggesting it was really a Mafia job that went spectacularly wrong. Because of their illicit nature at the time, many gay bars, including Stonewall, were run by organised crime. Eden herself accused Wojtowicz of getting into debt to the mob when he bought the wedding dress.

He terrorised eight people and he was the direct cause of someone being blown away Rich Wandell, Gay Activist Alliance

The police didn't accept Wojtowicz's version of events either. "They wouldn't believe the true story, that I was robbing a bank to get my lover a sex-change operation, so I had to invent a story," he says in the film. "So I signed a confession that said I met the vice president of Chase Manhattan bank and he told me how to do it."

But the film-makers don't think it was planned. Their film reveals just how chaotic the operation was.

Wojtowicz and his two accomplices, whom he had met in a bar, had spent the day cruising around New York, trying to find a bank to rob. Once, they dropped the shotgun, which went off, and had to flee. In a second bank, Westenberg bumped into his mother's best friend. The trio even went to watch a movie - The Godfather - for inspiration. The note they finally passed to a cashier in the third bank read: "This is an offer you can't refuse."

Few in the gay community stood by Wojtowicz.

"Nobody seemed to care," says Randy Whicker, a fellow member of the Gay Activist Alliance (GAA) pressure group, and a rare exception.

"The reaction of the GAA was one of horror. They would simply say we don't want to be involved, he's a mentally ill person, he's nuts," he says.

Former GAA president Rich Wandel still stands by that assessment. "The fact is, he terrorised eight people and he was the direct cause of someone being blown away. That's not Robin Hood to me, that's a very sick person," he says.

Image copyright Courtesy of Unleashed Films

Berg feels that Wojtowicz was a product of his time. "Here's a guy who was very much old-school macho Italian Brooklyn from the 1950s, who really went ahead with the times in the 60s and 70s. His story is like a unique Forrest Gump: it touches on the early gay rights movement, it touches on Vietnam, the beginning of the sexual revolution," she says.

"John was to me a bad, crazy individual, but the thing I liked about him was that he got heart," says George Heath, a former prisoner - and Wojtowicz's third "wife". Heath was a knife-carrying bank robber and jailhouse lawyer who took him under his wing and "married" him in the prison yard on 31 July 1974. "He loved to be married, he had to have a wife, so I became his third wife," he says. When Carmen Bifulco came to visit, the two wives would wave at each other.

Was the robbery really carried out for love, or was that just a myth invented by Wojtowicz to romanticise a bungled crime?

"Love is a very strange thing. Some people feel it more deeply than others," he told the judge during his trial, before accusing him of not loving his own wife.

Wojtowicz never cared what anyone thought of him, says Berg. "He was his own person. Nothing you could do would change his mind - on anything. Everything was non-negotiable," she says. This may have been his strength but it could also be a gigantic problem.

The exchange with the judge about love came before, not after, sentencing.

But Wojtowicz never had any regrets.

"If I had a dream and in that dream I saw everything that happened, would I still go out and do it? You're damn right I would still go out and do it!" he says in the film.

"I'm the gay Babe Ruth, I won."

So many of the protagonists have now died that this film may be the last word on the matter.

"He came from an era where the city was so different, it was the only environment that would allow people like him to exist," says Keraudren. "Like a blast from the past - it was a spectacular experiment in humanity."

All photographs courtesy of Unleashed Films.

Allison Berg and Frank Keraudren spoke to Newshour on the BBC World Service iListen again via the iPlayer

You can watch The Great Sex Addict Heist: The Dog at 22:00GMT on Wednesday 18 February on Storyville on BBC Four or catch up on iPlayer

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.