The Justice Department had considered filing an injunction to stop the deal from closing after the judge, Richard J. Leon of United States District Court in Washington, approved it on June 12. But it did not go ahead with the motion because AT&T said the media arm would be operated as a separate group, making it easier to unwind the business should the Justice Department succeed in an appeal.

The latest legal maneuvering will not immediately change the business. But if the Justice Department ultimately prevails in its appeal, AT&T would have to detach the Time Warner business, now renamed Warner Media.

The government’s approach to the AT&T-Time Warner merger contrasts sharply with its relatively quick approval of Disney’s proposed acquisition of 21st Century Fox’s entertainment properties. That agreement, in which Disney said it would pay $71.3 billion for Fox’s television and movie business, was approved in June, about six months after it was announced. Transactions of such size typically take a year or longer.

The Justice Department’s decision to appeal could benefit Rupert Murdoch, the Fox chairman, who has supported Disney’s offer over Comcast’s, according to Craig Moffett, a longtime media analyst.

Comcast appeared to already be backing away from its bid, but the government’s appeal could make the giant cable company move away even faster by raising more doubts about whether the Justice Department would approve such a deal.

“Lobbing in this hand grenade right now sort of seals Comcast’s fate,” Mr. Moffett said.

Comcast is locked in a separate bidding war for control of the European satellite broadcaster Sky, which has more than 23 million customers across five countries. After Fox improved its offer to control Sky on Wednesday, Comcast quickly topped that bid with one of its own, valuing the company at $34 billion.

The AT&T and Time Warner merger has generated such intense interest partly because of the political overtones. As a candidate, Donald J. Trump, who had frequently criticized the Time Warner property CNN as “fake news,” vowed to stop the AT&T-Time Warner merger if elected to the White House.