Mark Wahlberg and Ted’s appearance on this year’s Oscars presenting the Sound Mixing and Sound Editing awards may have only lasted nine minutes, but it was months in the making, I’ve learned. The decision to have the blockbuster hard-partying talking bear as part of the Oscarcast with his big screen co-star was made soon after Ted director Seth MacFarlane was named host of the 85th Academy Awards in October. MacFarlane and Oscar producers Neil Meron and Craig Zadan approached Ted distributor Universal Pictures to pay for the high-tech appearance, to which the studio quickly agreed. “It’s a great platform for us and makes total promotional sense with a Ted 2 in the making,” an insider told me of the studio dolling out the cash. Wahlberg signed on immediately last fall after a call from his co-star MacFarlane.

Related: Ted #1 Biggest R-Rated Original Comedy

After that, MacFarlane asked Ted co-writer Wellesley Wild to put the script together for the segment. The Oscar host himself then tweaked it, sources tells me. Just like when Ted appeared on ABC’s Jimmy Kimmel Live! last December, the movie’s producer Jason Clark took over putting everything together. Tippet Studios’ Blair Clark, who also did the visual effects on the movie, oversaw the 3D animation/motion capture. The segment you saw tonight was actually taped in mid-January. People in the Dolby Theatre tonight just saw Wahlberg standing next to an empty stool. That Ted and Wahlberg would be presenting the Oscars was announced February 1. With everything animated and completed, MacFarlane recorded the voice-over earlier this month in LA.

And that’s how a bong-smoking talking teddy bear made it to the Oscars.

Watch it again here:

Deadline's Dominic Patten - tip him here.