Forget Media General’s merger deal with Meredith. After months of negotiations, this morning it found a way to scrap that deal and accept $4.6 billion in cash and stock from Nexstar Broadcasting to create a local TV behemoth with 171 full power stations in 100 markets.

The deal is expected to close in the fall, assuming it’s approved by the FCC and antitrust officials. The buyer will then change its name to Nexstar Media Group, and would become the largest independent owner of CBS affiliates. The company says it plans to divest some stations in order to pass muster with the FCC’s ownership restrictions.

“We intend to implement our proven strategy of focusing on local programming and effective digital media marketing solutions across the assets being acquired and will marry best of breed practices from our existing operations with those from Media General,” Nexstar CEO Perry Sook says.

The companies agreed on terms earlier this month. They couldn’t complete the deal, though, without determining how Media General could back out of the $2.4 billion acquisition agreement it made in September with Meredith.

The magazine and TV station owner agreed to accept a $60 million break-up fee, as well as an opportunity to negotiate to buy some of Media Genera’s assets.

Terms of the Nexstar deal are complicated by Media General’s agreement to let the FCC auction some of the airwave spectrum it uses to wireless broadband providers. It would receive some of the proceeds.

But the basic agreement entitles Media General investors to receive for each share $10.55 and 0.1249 of a share in Nexstar Media. Media General shareholders would own about 34% of the stock. Two representatives from Media General would join the Nexstar board.

Nexstar made an unsolicited offer to buy Media General in September, after it announced its deal with Meredith. After weeks of dickering, on January 7 the companies unveiled the terms of the deal that they wanted pending resolution of the Meredith agreement.

Nexstar shares are down 4.4% in morning trading while Media General is unchanged. But Meredith is up 2.6%.