Google isn’t just helping Samsung by providing witnesses to help the South Korean corporation defend against Apple’s patent claims in their second U.S. trial; the company will also pay a share of Samsung’s legal costs and will share damages in case Apple wins, Re/code reports.

A Google lawyer on Tuesday took the stand during the trial, saying that Google agreed to take over the defense of some of Apple’s claims, and indemnify Samsung in case the company is found to have infringed on those particular patents.

Initially, Google agreed to “provide partial or full indemnity with regard to four patents” and defend against them, Google lawyer James Maccoun revealed in a deposition preceding the trial when he verified an email exchange between Samsung and Google on the matter.

“Maccoun’s testimony included references to a variety of emails between Google and Samsung between May and December of 2012 detailing Google’s willingness to take on Samsung’s legal defense,” Re/code writes. “Apple also read into the record a Samsung response from September 2012 in which it said that it was not seeking indemnification from any party.”

Two Apple patents were later dropped, with Google now having to defend and compensate Samsung in case of a loss for just two patents, the ‘414 and ‘959 patents that cover background synchronization and universal search, respectively. Even so, it’s not clear how much Google is paying for defense, and how much it would pay Samsung in case Apple wins any damages on those patents.

Google has to help with Samsung’s defense partly because of the “Mobile Application Distribution Agreement” Samsung signed in order to be able to preload Google apps on its Android devices. However, Google is likely to offer compensation for its proprietary apps only, including Google Search or Gmail, that are found on Samsung’s devices, rather than on the open source parts of the code.

Samsung and Google have inked a partnership earlier this year, amidst an increased number of reports detailing a rather tense relationship between the two parties.

Story continues

While Apple has not attacked Google directly in any of its patent-based trials against Android device makers, preferring to sue the companies that sell Android devices, the Search giant is clearly very interested and involved in defending Android.

More from BGR: The OnePlus One is the only Android phone you should really care about right now

This article was originally published on BGR.com

Related stories

Samsung's initial 250,000 Gear Fit stock already sold out

Samsung patent reveals a wild new smartphone design

The Galaxy S5 already accounts for nearly 1% of Android smartphones