Comcast said Thursday it would not pursue its bid to buy assets of Twenty-First Century Fox, choosing to focus on its offer for Britain's Sky.

Shares of Comcast rose 2.6 percent on Thursday, while Fox fell 0.3 percent.

The announcement ends one of the biggest battles in the media industry this year, as Comcast fought with Disney to acquire Fox's movie studio and television assets. Disney had recently outbid Comcast's $65 billion all-cash offer with a $71 billion cash-and-stock offer.

Comcast CEO Brian Roberts said in a statement, "I’d like to congratulate Bob Iger and the team at Disney and commend the Murdoch family and Fox for creating such a desirable and respected company."

Complicating matters was Comcast's bidding for Sky, which is 39 percent owned by Fox. The two companies were also engaged in a bidding war there, with two new offers on the table last week, Fox's valuing Sky at $32.5 billion and Comcast's raising that to $34 billion.

CNBC's David Faber reported earlier this week that the U.S. government's decision to appeal a court ruling allowing AT&T to go ahead with its acquisition of Time Warner had given Comcast reason to pause in its pursuit of the Fox assets. The government had sought to block the AT&T deal on competitive grounds.

Fox's Rupert Murdoch was also seen as favoring the Disney offer, Faber reported, citing sources.

On CNBC on Thursday, Faber said he called Iger about the Comcast announcement and actually broke the news to the CEO. Iger replied, "holy crap," according to Faber.

Here is the statement:

Comcast Corporation (Nasdaq: CMCSA) today issued the following statement regarding its pursuit of the assets Twenty-First Century Fox has agreed to sell to The Walt Disney Company: “Comcast does not intend to pursue further the acquisition of the Twenty-First Century Fox assets and, instead, will focus on our recommended offer for Sky.”

Brian L. Roberts, Chairman and CEO, Comcast Corporation, said, “I’d like to congratulate Bob Iger and the team at Disney and commend the Murdoch family and Fox for creating such a desirable and respected company."

Following the announcement, Iger issued the following statement:

Our incredible enthusiasm for this acquisition and the value it will create has continued to grow as we’ve come to know 21st Century Fox’s stellar array of talent and assets. We’re extremely pleased with today’s news, and our focus now is on completing the regulatory process and ultimately moving toward integrating our businesses.

Disclosure: Comcast is the owner of NBCUniversal, parent company of CNBC and CNBC.com.