The patent war between Facebook and Yahoo is escalating.

Update: 3:54 PT: Facebook today filed a counter-suit against Yahoo in U.S. District Court in San Francisco, defending its own patents and claiming that Yahoo infringes on some Facebook patents.

Ted Ullyot, Facebook's general counsel, said in a statement:

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.... 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.

Yahoo's suit against Facebook, filed in March, was far reaching, covering everything from placing ads on Web pages and customizing views for social users. The company's move came as it struggles to find its footing in a fast-moving market that has left the onetime Internet pioneer far behind. Yahoo is expected to announce more layoffs as early as tomorrow.

Yahoo's lawsuit, widely attacked throughout the tech world, came as Facebook is preparing for its IPO. Facebook's countersuit was expected, given that it's virtually the only way Facebook would have any leveraging power to negotiate a settlement.

"Facebook is following the playbook," said Erin-Michael Gill, the chief intellectual property officer for MDB Capital who had predicted this would be Facebook's next move. "They're doing exactly what potentially Facebook investors would expect them to do. They're leveraging the IP that they've acquiring the past few years. They're putting their best assets on the table and now can engage in negotiations from a far stronger position."

Yahoo released a statement late today saying Facebook's counterclaims are "without merit and nothing more than a cynical attempt to distract from the weakness of its defense." The company said that it has tried to engage Facebook in talks but has been rebuffed. "Other leading companies license these technologies, and Facebook must do the same or change the way it operates," Yahoo said.

In its counterclaim, Facebook draws a very different picture. The social network insists that it was the damaged party and asks the court both to award it damages and dismiss Yahoo's earlier complaint.

Facebook claims that Yahoo is infringing on a number of Facebook patents via functions that account for a huge chunk of Yahoo's revenue stream. Facebook's suit states:

Yahoo! infringes the Facebook patents-in-suit through, by way of example and not limitation, the Yahoo! Home Page, Yahoo!'s Content Optimization and Relevance Engine ("C.O.R.E."), the Yahoo! Flickr photo sharing service, and advertisements displayed throughout Yahoo! including My Yahoo!, Yahoo! Finance, Yahoo! Sports, Yahoo! News, Yahoo! Games, Yahoo! Movies, Yahoo Shopping, Yahoo! Travel, Yahoo! Autos, and Flickr.

In its complaint, Facebook said Yahoo infringed on the following patents: