How I Met Your Mother Ted (Josh Radnor) finally figured out the truth behind the pineapple incident on "How I Met Your Mother." Photo: CBS

The biggest mystery on “How I Met Your Mother” has finally been solved -- the show’s legendary gag of the mysterious pineapple! In Season 1 episode 10, Ted (Josh Rador) woke up from his drunken night of downing Carl’s “Red Dragon” shots with a sprained ankle, the faint memory of spending a night with a girl and a pineapple on his dresser. The mystery behind the bedroom produce then sent Ted and the gang on a wild fruit chase, attempting to uncover how the pineapple ended up on his nightstand. This lasted until the season concluded nine years later in March 2014.

A month after the series finale it was revealed that a deleted scene on the complete series DVD of “How I Met You Mother” would explain the long-running joke of The Pineapple Incident. So, how did the pineapple end up in Ted’s bedroom the night he invited Trudy (Danica McKellar) over? According to the never-before-seen footage, it was actually Ted who put the pineapple on his nightstand!

Remember when Marshall (Jason Segel), Ted and Barney (Neil Patrick Harris) marched to The Captain’s (Kyle Maclachlan) house during Season 9 episode 20 to retrieve Lily (Alyson Hannigan)? Marshall had thought Lily ran away from the Farhampton Inn to cheat on him with The Captain, but as it turned out she just wanted to take a pregnancy test. Well, before Ted left, The Captain said something a bit odd to the show’s protagonist.

“One thing I can forgive. Steal more than one thing, well’s that another matter,” The Captain said to Ted after he realized Zoey (Jennifer Morrison) wasn’t the only thing Ted took from him. (Zoey left The Captain to be with Ted, but ultimately the two broke up later down the line.)

“Got it. Thank You,” Ted responded, walking out the door. But a pineapple displayed on The Captain’s stoop stalled the protagonist. He then asked The Captain what the deal behind the front-porch fruit was.

"It's an old sea captain's tradition to put a pineapple on your porch as a symbol of hospitality,” he explained, sparking a flashback to 2005 of Ted stammering down a street where The Captain’s townhouse so happened to be located. Ted saw the fruit and drunkenly grabbed it, giving it a prickly kiss.

And that, kids, is how Ted ended up with a pineapple on his dresser. You can watch the entire unseen footage of Ted solving the mystery of The Pineapple Incident here on BuzzFeed.

What was your theory on The Pineapple Incident? Let us hear how you thought the fruit ended up on Ted's nightstand in the comments section below.