REYKJAVIK, Iceland — The television commercial for a local mobile phone company here wouldn’t work in many places outside Iceland.

It portrays a curly-haired couple who just woke up next to each other after what appears to be a one-night stand. (That isn’t the scandalous part in this famously liberal society.)

The two are pictured lingering in bed, on their smart phones, checking out a genealogical website called Íslendingabók. Their smiles freeze when they find out they are related. Closely.

While other nations might find the commercial funny — mainly for its “as if” value — Icelanders can relate on levels unimaginable in larger countries. The commercial works here because, in this isolated island country of 300,000 people, these situations actually happen. Regularly.

Most Icelanders have heard a story of somebody, who knew somebody, who found out a bit late in the game that the subject of their romance is actually an estranged cousin.

More from Wanderlust

Elin Edda says it happened to her friend. “She really liked this guy and then found out they had the same great-grandparents,” she says. “It really freaked her out and she broke it off. It was just too weird.”

Edda clarifies, however, that such mishaps only happen in families that aren’t close-knit. “It could never happen in my family. I know everybody,” she says.

When she meets an Icelander she doesn’t know, she asks the same question every else here does: “Hverra manna ert þú?” (Who are your people?)

For centuries, this is how Icelanders have gone about identifying their ancestors, since family names do not exist here. Foreigners are often amused by the fact that the Icelandic phonebook is organized by first names.

But Icelanders are increasingly migrating to cities and urban environments, which tends to make the traditional meeting — as well as mating — process more anonymous.

That’s one of the reasons Íslendingabók (the Book of Icelanders) has been so widely popular here. To avoid incest, all one has to do is put in their name, their prospective girlfriend’s or boyfriend’s name and the database will spit out exactly how related they are to each other.

Virtually every Icelander since the 18th century is in the database, according to the website. Any Icelander living now can sign up for a username and password and gain free access to some of the data, such as names and birth dates, and view full information on everyone who shares a great-grandparent with them. One can also find out if they have common ancestry with any given Icelander and uncover their exact lines of descent.

Aside from looking up lovers, one of the more popular ways to use the site is searching how one is related to famous Icelanders. Hence, locals can (and do) tell you exactly how many generations separate them from Björk, or more precisely according to Íslendingabók, Björk Guðmundsdóttir, born Nov. 21, 1965.

Alli Thorgrimsson, for example, learned that he and Björk are related seven generations back, on both sides. He shares a closer ancestral tie with the current prime minister, Jóhanna Sigurðardóttir. Thanks to Íslendingabók, he also knows that his ex-wife was his seventh cousin, or in other words, not close enough to trigger an incest alarm.

Thorgrimsson, 31, reckons he began using the site a decade ago, shortly after it became popular. He has looked up the girl he was dating at the time and has done the same with every girlfriend since.

“It was curiosity to see how far away we're related, because the chances of me meeting a girl and not know that she's a close relative are slim to none,” he said. Still, even though he wasn’t expecting to find he was dating a first cousin, he was surprised to find out he was, in one way or another, related to every single Icelandic girl he has ever dated.

This conclusion would hardly surprise Friðrik Skúlason, a software entrepreneur who created Espólín, an online genealogical database of Icelanders as a hobby in the early 1990s. Later, Skúlason and the founders of an Icelandic genetics company, Decode Genetics, formed Íslendingabók.

The original idea was to use the online genealogical database and combine it with medical records to help them see how inherited diseases are spread through generations. In turn for their willingness to participate in the genetics research, Decode gave Icelanders access to what they were truly interested in: genealogy.

“Icelanders are obsessed with genealogy,” says Kári Stefánsson, founder of Decode Genetics. “We are an extraordinarily narcissistic nation.”

The site became immensely popular almost immediately. It wasn’t without a few well-publicized scandals, though. Those early hiccups mostly dealt with privacy issues, specifically the one Icelanders refer to as “rangfeðrun,” or the fact that people’s recorded fathers are not always their biological fathers.

Stefánsson estimates the database is "99.9 percent accurate" when it comes to matriarchal relationships. “The question is errors in paternity. Non-scientific literature says it’s about ten to 15 percent. That’s bullshit,” says Stefánsson. “It’s only about one percent.”

According to Stefánsson, Iceland is one of the world's most genetically homogenous nations. To put it bluntly, Icelanders — because there are so few of them — are more likely to have children with somebody that they are related to.

Contrary to popular belief, this is good news for fertility rates, says Stefánsson.

It turns out that fertility works best when couples are sufficiently related to each other because their genes are more compatible. A study published three years ago by Decode in Science Magazine reported “significant positive association between kinship and fertility, with the greatest reproductive success observed for couples related at the level of third or fourth cousins.”

Luckily, it’s never been easier to find third and fourth cousins in Iceland.