Facebook said Tuesday that it has filed a countersuit against Yahoo, claiming that Yahoo violates Facebook patents that relate to photo-sharing, the news feed, tagging digital media and other Web elements that build in social features in Web sites.

In a statement, Facebook general counsel Ted Ullyot said that the case is in response to Yahoo’s decision to sue Facebook in March.

“From the outset, we said we would defend ourselves vigorously against Yahoo’s lawsuit, and today we filed our answer as well as counter-claims against Yahoo for infringing ten of Facebook’s patents,” Ullyot said in a statement. “While we are asserting patent claims of our own, we do so in response to Yahoo’s short-sighted decision to attack one of its partners and prioritize litigation over innovation.”

In an e-mailed statement, Yahoo said, ‘We have only just received Facebook’s answer and counterclaims, but on their face we believe they are without merit and nothing more than a cynical attempt to distract from the weakness of its defense. As we have made clear from the outset, the unauthorized use of our patented technology is unacceptable and must be resolved appropriately. Other leading companies license these technologies, and Facebook must do the same or change the way it operates. We have proposed that Facebook join us in discussions to resolve the matter, but our overtures have been rejected. As a result, we are prepared to continue to seek redress through the courts.”

Yahoo said last month that Facebook is violating 10 patents that relate to privacy, social networking, messaging and online customization. In its court filing Tuesday, Facebook addressed Yahoo’s claims one by one, denying allegations that it infringes on any of the patents laid out in the earlier suit.

Experts said that Yahoo filed suit against Facebook in an attempt to settle with the company, which has filed its paperwork to go public in what it widely expected to be a $100 billion IPO this spring.

Yahoo used similar timing to its advantage when it took on Google in a 2004 lawsuit, All Things Digital’s Kara Swisher noted last month, which resulted in a settlement that granted Yahoo millions of shares of Google stock.

Related stories:

Yahoo goes after Facebook at a vulnerable time

Wonkblog: Yahoo sues Facebook. Are software patents out of control?

Facebook in a tough position, experts say