SpongeBob SquarePants has introduced SpongeBob’s parents and other family members, as well as Mr. Krabs and Pearl’s family and even Plankton’s relatives, but there are two main characters that are related, but their relationship is not as close as it probably should be: Patrick and Gary. But how exactly can a dim-witted starfish and a highly intelligent snail be related? Created by marine science educator turned animator Stephen Hillenburg, SpongeBob SquarePants debuted on Nickelodeon in 1999, becoming one of the longest-running American animated series.

SpongeBob SquarePants follows the daily adventures of the title character in the underwater city of Bikini Bottom alongside his best friends Patrick Star and Sandy Cheeks, as well as his neighbor Squidward Tentacles and his boss Mr. Krabs. SpongeBob has a pet snail named Gary, who might seem innocent and quiet, but is actually very intelligent and has a complex personality – the complete opposite to SpongeBob’s best friend, Patrick.

Related: SpongeBob SquarePants: The Secret Box Explained (& How It Changed)

Patrick is lazy, naive, immature, and quite ignorant, causing a lot of trouble for SpongeBob. Gary and Patrick have nothing in common except being very important in SpongeBob’s life, but as it turns out, these two characters are related, and it’s not like they are distant relatives.

Gary Spongebob Squarepants

In season 4’s episode “Rule of Dumb”, Patrick is visited by the Royal Ministry, who tells him he has uncovered a family tree that shows Patrick to be descended from a king (King Amoeba, to be exact), and as Patrick is his great-great grandson, that means he’s now the king. Patrick becomes a tyrant, scaring SpongeBob and prompting him to walk away. Realizing he’s becoming a monster, Patrick gives the crown back to the Royal Ministry, who tells him that there was a stain on the other side of Patrick’s family tree, and the real king is Gary, the snail.

This weird connection can be traced back to King Amoeba, who married Queen Mildew (a fish). Their daughter, Princess Tulsa, who was also a fish, married another one, which somehow resulted in Maw Tucket being a starfish. Maw married another starfish, Billy Bob, and their children were a snail named Sluggo and a starfish named Herb. Patrick is the son of Herb and Margie Star, and brother of Sam Star, while Gary is the son of Sluggo and an unrevealed mother. This means that Patrick and Gary are first cousins, and it also means that biology works in very mysterious ways in the world of SpongeBob SquarePants.

Though Gary and Patrick have an amicable relationship (Gary even left SpongeBob for Patrick for a while in the episode “Dumped”, though he only wanted the cookie in his pocket), they are not as close as SpongeBob and Gary or SpongeBob and Patrick. The connection between Patrick and Gary was never addressed again, nor was Gary’s role as king, but it’s a fun detail that adds to the show’s overall weirdness.

Next: SpongeBob SquarePants: When The Show Turned Bad