Exelon Corp., the Chicago utility giant that owns Peco Energy Co., on Thursday said it had agreed to buy Constellation Energy Group Inc. of Baltimore for $7.9 billion, creating one of the nation's largest electric power companies.

Constellation is the parent of Baltimore Gas & Electric, which serves 1.2 million electricity customers and 630,000 gas customers.

With Peco, which has 1.6 million electricity customers in the Philadelphia area, and Commonwealth Edison in Illinois, the merged companies would serve 6.6 million customers.

The enlarged Exelon would also be the nation's biggest competitive power generator, with more than 34 gigawatts of output, as well as the nation's largest nuclear-energy producer.

The merger would join two companies that have tried and failed to form other marriages in recent years to cope with the energy sector's increasing competition and tightening margins.

"I have always said more scale would be good," said John W. Rowe, Exelon chairman and chief executive. He said he planned to retire after the merger is completed early next year.

Exelon president Christopher M. Crane, who will become chief executive after Rowe retires, said in an interview that some Exelon jobs in Pennsylvania would shift to Baltimore, but that there would be no net change in the company's workforce here. Exelon employs 6,200 people in Pennsylvania at Peco and its power-generation facilities.

One of the merger's main attractions is the combination of Exelon's big fleet of power plants with Constellation's growing business of selling and trading power to large industrial and commercial customers. Mayo A. Shattuck III, Constellation's chief executive, called it a "perfect marriage."

Constellation shareholders will receive 0.93 share of Exelon for each Constellation share.

The offer values Constellation at $38.59 a share - 12.5 percent above its Wednesday closing price of $34.30, or an 18.1 percent premium based on the 30-day average share price.

When the deal is completed, Exelon shareholders will own about 78 percent of the company and Constellation shareholders the rest.

About half the merged company's earnings would be derived from its regulated utilities in Philadelphia, Baltimore, and Chicago. Though the utilities produce steady earnings, the power-generation and trading businesses have greater growth potential.

Crane said the retail enterprise would remain in Baltimore and operate under the Constellation name. Exelon's current trading group, based at the company's Kennett Square complex, would move to Baltimore.

Exelon's renewable-energy group would also be consolidated in Baltimore.

But Crane said the Chester County job losses would be offset by increases in Exelon's power-generation and nuclear units, also based in Kennett Square.

Exelon will move the headquarters of its nuclear subsidiary, now in Illinois, to Kennett Square. And Exelon Generation, the company's nonnuclear subsidiary, would absorb Constellation's power-generation staff.

"So it's jobs neutral, and still a very, very strong presence in Pennsylvania, not to erode at all," Crane said.

Rowe, who created Exelon with the 2000 merger of Peco Energy and ComEd parent company Unicom, has tried three times in recent years to buy smaller rivals: Illinois Power Co., Public Service Enterprise Group Inc., and NRG Energy Inc.

He said Exelon may have better luck with the Constellation merger.

Exelon officials said they fashioned their offer for Constellation based on the terms that the Maryland Public Service Commission recently accepted in the merger of FirstEnergy and Allegheny Power.

Exelon will give each BGE customer a $100 credit after the merger and promised not to reduce the Baltimore utility's workforce for two years.