Houston's Targa Resources said Monday it will acquire Atlas Pipeline and Atlas Energy in a multibillion-dollar deal that will bring Targa into several of the hottest shale plays across the country.

A complex multipart transaction involving several corporate entities will add to Targa's holdings in West Texas' Permian Basin, and gain it entry into three more booming regions - the Eagle Ford in South Texas; Mississippi Lime in Oklahoma and Kansas; and South-Central Oklahoma Oil Province plays in Oklahoma.

The new assets will also add to Targa's natural gas liquid processing and transportation facilities, now anchored by a Gulf Coast export terminal.

The largest chunk of the deal will be Targa Resources Partners' acquisition of Atlas Pipeline Partners for $4 billion in cash and stock. Targa will also assume about $1.8 billion in debt. Atlas Pipeline Partners owns and operates midstream assets in Oklahoma, Kansas, Texas and Tennessee, including gas processing plants, gas treating facilities and gas gathering pipeline.

Each Atlas Pipeline Partners unit-holder will receive 0.5846 units of Targa Resources Partners and a cash payment of $1.26 per unit.

In the second part of the deal, Targa will purchase Atlas Energy LP for a total of $1.87 billion, including 10.35 million Targa Resources shares valued at $1.2 billion and $610 million in cash.

Before that purchase, Atlas Energy will spin off its non-midstream assets, which include stakes in more than 14,500 natural gas and oil wells nationwide, into a separate company

The Atlas entities are headquartered in Tulsa, Okla.

The companies expect the deals to close in the first quarter of 2015.

In a conference call with investors, Targa CEO Joe Bob Perkins said that the deal puts the company into four of the top five basins by active rig count and the top three basins by oil production. Targa already has property in the North Dakota Bakken Shale, another area where production has risen sharply.

The transaction is a role reversal from what some analysts expected as recently as this summer - that Targa might be up for sale.

In June, reports of a possible takeover by Energy Transfer Equity prompted Targa to put out a statement saying that there had been "high-level preliminary discussions" about a deal, and that those talks had been ended, but it left the door open for exploring a deal later.

"There are no assurances whether or not discussions could resume," the company said then.

On the call with investors, Perkins said that the deal announced Monday wouldn't impede the possibility of continuing such talks, and directed analysts to the June statement.

Becca Followill, head of research and midstream analyst at U.S. Capital Advisors, said the deal will benefit Targa over the long term, but its stock fell Monday, and she said investors may have removed a premium the company enjoyed when it was viewed as an acquisition target.

"They were previously viewed to be the hunted, and now they're the hunter," Followill said.

Targa Resources Partners is a master limited partnership, a tax-advantaged corporate structure common in the midstream sector that typically distributes all its profits to investors called unit-holders.

Targa Resources Corp. is its parent company, owning general and limited partnership interests.

Units of Targa Resources Partners fell $4.75 to $59.23 in New York Stock Exchange trading Monday. Targa Resources Corp. fell $12.64 to $109.01.

Atlas Pipeline Partners units rose 43 cents to $34.05. Atlas Energy rose $4.84 to $37.25.

In addition to viewing the deal as making it less likely that Targa will be acquired, Followill said, investors may have driven its stock down out of concern that the acquisition could increase Targa's exposure to fluctuations in the prices of oil and gas.

Before the merger, about 68 percent of Targa's contracts were based on fixed fees, which insulate a processing and transportation company from swings in commodity prices. After merging assets with Atlas, the percentage will fall to about 60 percent.

Oil prices have fallen to four-year lows in the past few months, with U.S. benchmark crude down 8 cents on Monday to $85.74 a barrel on the New York Mercantile Exchange.

On the call with investors, however, Perkins said that the company's now-larger portfolio will have a stabilizing effect.

"The increased scale and diversity more than offsets the slight decrease in percent fee, in our opinion," he said. "We've gotten reasonable receptivity from the rating agencies in our discussions about that."

In a separate call with analysts, Atlas CEO Ed Cohen said the non-midstream company it is spinning off, Atlas Resource Partners, will generate significant value. Cohen said the company has been undervalued.

"We're just extremely disappointed at the market's failure to recognizeso far the things that we're accomplishing," Cohen said.