SAN JOSE — Google agreed to run Samsung’s legal defense and shoulder the costs of patent litigation with Apple over some features of the Android operating system, according to emails shown in court Tuesday.

In a deposition played for the jury, Google patent counsel James Maccoun verified emails in which Google executives offered to defend and indemnify Samsung against some of the claims in its latest patent trial with Apple over smartphone and tablet technology. Apple lawyers played Maccoun’s deposition, which was taken in August 2013, as they kicked off their rebuttal in the monthlong patent case before U.S. District Judge Lucy Koh in San Jose.