Once he was legally allowed to be funny once again on television, Conan O’Brien had to make a choice.

And the decision he made came as a huge surprise to the television world Monday, as TBS announced that O’Brien would host an 11 p.m. yakker beginning in November.

“In three months I’ve gone from network television to Twitter to performing live in theaters, and now I’m headed to basic cable,” O’Brien said. “My plan is working perfectly.”

In moving to cable, O’Brien abandoned the obvious option — launching a latenight franchise on Fox. But Fox-owned and affiliated stations were complicating matters with their off-net sitcom obligations, and talks were moving slower than the 405 in rush hour.

“Clearly it was weeks away if it were to happen at all at Fox,” one insider said.

But Fox hadn’t been the only possibility. Across town, CBS TV Distribution’s offer to launch a weeknight half-hour starring O’Brien — and targeting the prime access 7:30 p.m. slot — had been gaining traction within Team Coco.

“CBS thought they could make a lot of money on the show,” said one exec.

But syndication is a gamble, and that half-hour would be farremoved from what O’Brien had done for 17 years at NBC.

Other cable networks were still in play, although one rumored option, Comedy Central, appeared unlikely. Talk of a show on FX — supplemented by secondary coverage on some Fox-owned stations — was also on the table.

Then came the phone call that set O’Brien on the path to TBS.

It came last month from TBS/TNT/TCM programming president Michael Wright to O’Brien manager Gavin Polone. Wright’s question to the rep: Would TBS be an option for the former “Tonight Show” host?

“You already have George Lopez,” Polone told Wright.

But execs at the cable net had done their homework. Turner Entertainment Networks prexy Steve Koonin quietly stood aside in January and February as the NBC latenight mess unfolded — but as he began his planning for fall, O’Brien was on the top of his list.

“We looked and said there’s a once in a lifetime transformational talent in Conan and said, ‘let’s go get him,'” Koonin said.

First, Koonin and Wright sat down with Lopez to pitch him the idea of O’Brien as a lead-in. According to Turner Research stats, “Lopez Tonight’s” young male audience might be better served at midnight where there’s less competition and with an O’Brien lead-in.

Lopez was quickly sold — surprising some and relieving others. No one, after all, wanted a repeat of what had just happened to O’Brien at NBC — where the Peacock planned to bump O’Brien’s “Tonight Show” to midnight to make room for Leno at 11:35, leading to O’Brien’s quick exit.

To persuade O’Brien that it wasn’t the case here, Lopez personally contacted O’Brien early last week and gave him the hard pitch.

“George sold it,” Polone said. “Conan would have never engaged if there was even a hint that George was being strong-armed. But the statistical analysis said George would do better. I bet he’ll have improved numbers at midnight.”

And so began a whirlwind 96 hours of negotiation. Atlanta-based Koonin logged countless miles as he traveled back and forth to Los Angeles to make the deal.

Despite the complexity of what was on the table — something that had taken Fox months to work through — Turner and Team Conan managed to make everything come together in no time.

“I’ve never had a deal this complex done in two days,” Polone said. “They had all their business affairs execs in one room, and Koonin was personally involved.”

In an example of the spirited give-and-take, Turner would offer up a deal point, and Team Conan would give a counter proposal. Rather than take days to mull it over, the Turner execs would come back within hours with an answer. Most of the time, it was a “yes.”

According to Koonin, the “business terms are comparable to what he was being offered elsewhere.” O’Brien pulled about $12 million a year at the “Tonight Show,” and his five-year Turner arrangement is believed to be in the same ballpark.

Koonin declined to discuss specifics, but added, “I personally think he’s happy with the compensation.”

O’Brien ultimately stands to pull a heftier profit, as he’ll own his Turner show. Such a stake was important for O’Brien — and something that wasn’t possible at NBC, where “Tonight” is an institution. David Letterman owns his CBS “Late Show,” which allowed him to negotiate a waiver with the WGA during the last writers strike.

“Owning a show is a transformational event, and we thought Conan should move from employee to owner,” Koonin said.

Turner and Team Conan, which also includes agent Rick Rosen, finished the TBS pact late Friday night.

“With George and now Conan, this signals to people that we’re in the comedy business in a big way,” Koonin added.

Turner’s deal with O’Brien could also eventually extend to the host’s Conaco shingle, which is still wrapping up its deal at NBC Universal. O’Brien has the John Eisendrath pilot “Justice” in contention at the Peacock. Koonin said he foresees developing comedy projects with Conaco.

“We want to be in business with him on multiple levels,” Koonin said.

In pacting with Turner, O’Brien will now be able to resurrect much of his “Tonight Show” and “Late Night” infrastructure. Longtime O’Brien exec producer Jeff Ross was heavily involved in the TBS negotiations and is on board. Even sidekick Andy Richter is expected to be back. Much of O’Brien’s latenight gang is currently part of the 30-city “Legally Prohibited From Being Funny on Television” tour, which kicked off Monday night in Eugene, Ore.

As for Fox, insiders said execs at the broadcast network told Team Conan last week that they couldn’t make a deal work.

But that’s not to say Fox wasn’t still interested; a meeting was scheduled with Fox Entertainment chairman Peter Rice this week to explore new options.

“Conan is a great talent and we wish him every success,” Fox said in a short statement.

The prospect for a Fox show was limited, however, as the net was running into serious financial roadblocks in clearing a latenight yakker.

It was a given that divisions such as the Fox TV Stations, Twentieth Television and 20th Century Fox TV would all take at least a short-term financial hit should an O’Brien latenighter become a reality for Fox.

According to one exec, stations might have collectively lost as much as $40 million to $50 million with an O’Brien deal, as off-net sitcom contracts might be broken — and stations would suddenly have fewer local spots to sell at 11 p.m.

And given the off-net sitcom contracts that Fox’s O&Os and most of its affiliates have in place, it was looking more likely that an O’Brien show would air at 11:30 p.m., and even midnight in some markets, instead of 11 after Fox affils’ 10 o’clock newscasts. An 11 p.m. talker might have hit 60% of the country at best.

Considering that O’Brien exited NBC after that network downgraded his time-slot, he likely didn’t want to wait years to secure full in-pattern clearances on Fox across the country.

“It was a narrow group at Fox moving (the idea of an O’Brien talkshow) forward,” said one observer. “But I understand Rupert Murdoch was very much going to try and make this happen. He’s known for gambling with News Corp. in terms of acquisitions like the Wall Street Journal.”

Insiders said they believed there was a process in place within Fox in which people felt eventually they would get Murdoch to sign on — and once he did, that everything would fall into place.

“But it wouldn’t have been smooth,” an exec said.

TBS, on the other hand, will allow O’Brien to be seen virtually nationwide, in-pattern, immediately. Turner will also heavily promote O’Brien’s arrival in October during its baseball playoff coverage.

And Koonin has promised to throw a ton of promo weight behind O’Brien’s arrival. TBS already was running spots on Monday night announcing Coco’s arrival.

“Conan had a lot of choices,” Koonin said. “And he really liked what we had to say. We’re a comedy environment. We don’t have late local news as a lead-in, we’ve got sitcoms and movies. We told him we’d give him an environment to be successful. His job is to make the show he wants to make.”

Koonin and Polone, among others, said they were surprised that news of O’Brien’s TBS deal didn’t leak. The number of individuals familiar with the negotiations continued to grow — and once Lopez called O’Brien to give his blessing, the players involved braced for the news to leak.

And yet it didn’t. Koonin said he believed the press was myopic in assuming that O’Brien would go to another broadcast net.

“One of the big mistakes the press mae was to think that cable is a little engine — and we’re not,” he said. “We have more talent on TBS and TNT than any broadcast network.”

And to prove his point, Koonin plans to make a splash in May, when Turner once again throws its upfront presentation along side the broadcasters — and this year shows off his big prize, Conan O’Brien.