After years of positive relations, friendly blog posts, and referral traffic, Yahoo may have just been biding its time waiting to declare war on Facebook. Today it suddenly accused its former ally of infringing on 10-20 of its patents. It demands a settlement from Facebook or it says it will sue. The betrayer only warned Facebook privately once the New York Times had publicly published details passed to it by Yahoo. Though dastardly opportunistic, this patent trolling could produce a big windfall for Yahoo’s investors.

Facebook tells me it was blindsided, saying “Yahoo contacted us at the same time they called the New York Times, so we haven’t had the opportunity to fully evaluate their claims.” Facebook has been very conservative about its use of patents. It bought some especially far-reaching social networking patents originally owned by Friendster from Malaysian company MOL for $40 million in 2010, but never used them offsensively even when it felt threatened by Twitter.

Yahoo has long worked closely with Facebook, using the social network to power sign-up and login of its email service and Flickr. Just 11 days ago, Facebook congratulated Yahoo in a blog post noting its Open Graph protocol had helped Yahoo’s news reader app gain 25 million users, including 2 million each day, and more than 500,000 referrals a day. I doubt we’ll see such courtesies between these two anytime soon.

Today’s attack comes at a particularly vulnerable time for Facebook, during the quiet period leading up to its IPO. Facebook could be forced to license the patents or settle with Yahoo by paying out pre-IPO stock, the same way Google was coerced into giving Yahoo 2.7 million shares in a patent settlement before the search giant’s 2004 IPO.

Details are sketchy on which of Yahoo’s patents it believes Facebook has infringed upon. However, Forbes reported in November that Yahoo held 1,100 US patents with 2,661 pending, and it could have 3-4x that many international patents. These include patents on paid search that Facebook may be violating through its deal with Microsoft Bing, and basic social networking patents that could apply to core parts of Facebook’s business.

Yahoo has held these patents defensively for years as a deterrent to trolling by other patent holders. But Facebook is a young company without a robust portfolio, and with record buzz about its IPO, now might be the perfect time to shake down the social network. A Yahoo crony tells the NYT that the two companies met today, and now it says “We must insist that Facebook either enter into a licensing agreement or we will be compelled to move forward unilaterally to protect our rights.”

Honestly, this is despicable. After relentlessly stagnating as Facebook innovated, to now try to extort Zuckerberg’s company just as it enters the spotlight reeks of desperation. The only positive news from Yahoo in recent memory was thanks to the viral nature of Facebook’s social graph that Yahoo may says it owns the rights to. Did the Winklevii join Yahoo’s board?

GigaOm’s Mathew Ingram puts it eloquently:

https://twitter.com/#!/mathewi/status/174305600669356033

Perhaps Yahoo sees Facebook as too big of a threat to its ailing display ad business. Even if it does score cash or stock in a settlement, Yahoo’s shareholders should be worried. Your business model shouldn’t depend on the remarkable shortsightedness of a patent officer who thought it was ok to let someone own the concept of connections between personal profiles online.

[Image Credit: Cambria Politico]