WHEN you can't beat them, sue them. That seems to be the modus operandi of Yahoo!, a former web star whose fondness for lawyers has grown as its commercial fortunes have faded. On March 12th the ailing company sued Facebook, alleging that the social-networking giant had violated ten patents that belong to it. Yahoo!'s aggressive move has sparked an outcry among the tech elite, many of whom have been quick to leap to Facebook's defence. Lobbing patent lawsuits at one another has become something of a pastime for technology companies. In such sectors as the mobile-phone industry, barely a day goes by without some new legal tussle hitting the headlines. But the world of social networking has been pretty much immune to this flood of litigation—at least until now. Yahoo!'s suit not only broadens the field of hostilities, it also comes at a sensitive time for Facebook, which is preparing for a multi-billion dollar stockmarket listing that is expected to take place in the next few months. This is not the first time that Yahoo! has reached for its lawyers to target a firm about to go public. In 2004 it launched a legal assault on Google involving patents shortly before the search firm staged its own listing. Google ultimately agreed to a settlement over the matter, taking a $200m charge against its earnings to do so. Yahoo! is no doubt hoping that Facebook will throw in the towel as well to avoid awkward legal wrangling in the run-up to its initial public offering (IPO). If Facebook does give in, it will not be because Yahoo!'s case is a strong one. Yahoo! argues that it is simply defending inventions that it has spent billions of dollars to develop. But many of the patents at issue cover common practices in online advertising, privacy controls and instant messaging. With a bit of effort, Facebook's lawyers should be able to show these were already in widespread use before Yahoo! laid claim to them.

Nor is Yahoo!'s argument that Mark Zuckerberg, Facebook's co-founder and chief executive, knowingly pinched its ideas likely to stand up to scrutiny. In its complaint, the firm's lawyers quote Mr Zuckerberg saying that if Facebook had not created its network when it did, someone else would have. In a desperate attempt to bolster a feeble case, they claim that this is proof of Facebook violating Yahoo!'s patents. If that is the best they can do, then Facebook should have little to worry about if it has its day in court.

This is not the first time that others have asserted prior ownership of Facebook's ideas in lawsuits. Two of Mr Zuckerberg's fellow students at Harvard University, Tyler and Cameron Winklevoss, claimed that he stole their idea for a social network after doing some programming work for them (which earned them the moniker "Winklevii"). After bouts of protracted legal wrangling, Mr Zuckerberg managed to see off that challenge. Facebook says it also intends to defend itself “vigorously” against what it calls Yahoo!'s “puzzling actions”.

Yet the internet firm's legal gambit is not really puzzling at all. Silicon Valley is full of companies with amazing growth stories to tell and innovative ideas to promote. Sadly Yahoo! is no longer one of them. Instead, the company has shed senior executives and board members as it desperately tries to turn itself around. Now it seems to be taking a leaf out of the book of other once-glorious businesses that have fallen on hard times, such as Eastman Kodak, which have tried to exploit their large patent portfolios to raise badly needed cash.

Even if Yahoo! does end up trousering millions from Facebook, it will be a pyrrhic victory for the business. The lawsuit has already done much damage to the firm's image. Although some folk have backed the company, many have criticised it. One of its former board members, Eric Hippeau, has described the suit as a “pathetic and heartbreaking last stand for Yahoo!”, and a former employee has publicly castigated the firm for “weaponising” the result of his work. If Yahoo! is to pull itself out of its nosedive, it needs to attract Silicon Valley's best and brightest to its ranks. By lashing out at Facebook now, it has made an already tough job far harder.