In the end, it wasn’t Keith Olbermann’s wacko politics, bipolar tantrums, or the Comcast takeover that set his MSNBC career on a col lision course with an iceberg.

It was Ben Affleck.

A source formerly with the cable network said the end began in April 2009, when Rachel Maddow booked Hollywood’s darling to appear on her show. Olbermann wanted the star for himself on “Countdown.”

It was the first battle Keith didn’t win.

“In protest, he refused to go on the air,” said the ex-colleague.

It wasn’t his first meltdown. A year and a half earlier, MSNBC had moved studios from the Jersey boonies to Rockefeller Center. When Olbermann discovered that his new office door had a built-in window, he went ballistic, phoning network President Phil Griffin and threatening to walk.

“I mean literally, Andrea. Over the door!” said the source. “Keith made such a fit about it. He was ugly and mean. But no one came to his defense.

“Part of me feels sorry for him. He can’t blame alcoholism. That was just a normal thing for him to throw tantrums.” The door was replaced.

But it begs the question: Can Keith Olbermann be saved? Or, like Norma Desmond, will he fade, screaming, into the sunset?

After he lost Affleck, Olbermann staged a three-day sickout. He later claimed that he vanished from the air to mourn his mother (and attend baseball games). But Olbermann’s mom died nearly two weeks earlier, CityFile reported, and he didn’t miss a day of work. Until Ben.

Last April, Olbermann went nuts when Donny Deutsch was hired as a guest host on MSNBC. He got Deutsch bumped.

“Donny was p- – -ed,” said a source.

Shortly after that, Olbermann first proposed walking away from more than two years on his $7 million-a-year contract, as The Post reported. Then, just as suddenly, he stayed put. In November, he was suspended two days for making political contributions. But he never apologized. He truly believed he was being persecuted.

So earlier this month, when Olbermann again whined that he wasn’t happy, MSNBC brass couldn’t wait to be rid of him.

“He has no friends, nobody to go to,” said one former pal. “He said, ‘I can’t take this! This is too much for me!’ Well, guess what. Nobody cared.”

Tales of Olbermann’s unhinged behavior go back almost to the beginning of his career. In the ’90s, he anchored ESPN’s “SportsCenter.” “He didn’t play so nicely in the sandbox,” said an ESPN source.

“He was condescending to those who didn’t see things his way. What recently happened was a blast from the past, as far as we’re concerned.”

After a female ESPNer wrote a book, “one day,” said the source, “Keith counted how many swear words were in it.” He sent the results to the entire newsroom. “Why? To embarrass her? To draw attention to himself? It did not add to the workplace.”

In 2004 — seven years after he left — Olbermann was the only on-air personality excluded from SportsCenter’s 25th-anniversary reunion week.

His fits of pique are wearing thin. He was fired in a fury from Fox Sports in 2001. Last year, he quit writing for Daily Kos, apoplectic that an online commenter suggested he’d criticized President Obama to improve his TV ratings. Any journalist who’s leveled even mild criticism was likely to be named Olbermann’s “Worst Person in the World,” as Jeff Bercovici learned when he wrote in DailyFinance.com that Olbermann’s ratings nose-dived because of such outrages as his calling Massachusetts Sen. Scott Brown a “racist.”

“As he’s gotten more strident and more lost inside his own navel, the segment became less of a joke,” said Bercovici, now at Forbes.

Who loves Keith? Olbermann, who turned 52 Thursday, has never married. He lived three years with WNBC newsblonde Katy Tur, half his age. So I e-mailed Katy, a reporter I might run into on the street, not expecting an answer. I was floored when NBC Universal’s director of communications responded, saying “Ms. Tur” wasn’t talking.

One diva deserves another.

TRUTH? NO CONSEQUENCES

As long as Charlie Sheen hauls in megabucks for CBS, authorities in three states, plus every hooker on Craigslist, will look the other way as he self-destructs, taking innocents with him.

Charlie was rushed to a Los Angeles hospital last week suffering abdominal pain after an all-night bacchanalia fueled by a Gucci satchel full of cocaine and five women, some of whom remove their clothes for a living.

Is the party over for Charlie? As long as there are no consequences for his laying waste to a Plaza hotel suite and terrifying a naked escort, as long as there’s no punishment for his threatening his wife with a knife — I doubt it. I won’t miss him when he implodes.

Oprah, enough!

Oprah Winfrey is weirding me out.

Just over a month ago, she denied that she enjoys sapphic sleepovers with camping buddy Gayle King, telling Barbara Walters, “I’m not even kind of lesbian.”

Then, in a bit of too-much-information TV, she told Piers Morgan that losing a baby at age 14 was a “blessing in disguise” — in that it gave her a second chance at, well, becoming a billionaire.

And last week, she revealed on her show the heavily hyped, “earth-shattering secret” that she has a half-sister whom her mother long ago gave up for adoption.

Oprah delivered the confessions, like nervous tics, just ahead of giving up her eponymous talk show.

“At some point, she went from being an inspirational example of strength and hope to this self-promotional talking head whose face haunts you at the grocery-store checkout,” Cynthia Dermody wrote in thestir.com.

Is there anything left to reveal?

Stay tuned, Oprah fans.

Riders on the storm

Quit bellyaching. The folks who run your subways have red blood pumping through their black hearts after all. About 100 passengers were trapped on an N train during last week’s snowstorm — then told to walk home from Coney Island. Stranded riders instead commandeered the train at 2 a.m., and refused to leave.

MTA officials and cops finally took pity on the cranky, cold commuters and let them sleep on the train. Bolt upright. For four hours. With the heat on!

As a bonus, no rats were spotted scampering on cars, like those videotaped prancing near and on grossed-out riders of the 4 and R lines. And, hey, straphangers didn’t get billed for the warm overnight accommodations.

Remember the MTA’s generosity next time fares go up.

Turkish delight

A Turkish man living in Germany has asked cops to protect him from his wife’s insatiable sexual demands. He says he needs sleep. She won’t leave him alone.