Two Am Law 200 firms with longtime ties to the Great White North are advising alongside two top Canadian firms on a $3.8 billion oil and gas merger this week that will create the largest producer in North Dakota’s lucrative Bakken Shale formation.

The effects of the energy boom in North Dakota have been well-documented in recent years, from the strains on the state’s small legal services market to an influx from those practicing the world’s oldest profession.

The proposed tie-up announced this week between Denver-based rivals Whiting Petroleum and Kodiak Oil & Gas will create a company with a dominant exploration and production capacity among those looking to get rockin’ in the Bakken. Over the past few months, North Dakota’s Bakken play has generated record outputs, according to state oil production data analyzed by conservative think tank the American Enterprise Institute.

Under the terms of the merger agreement, Whiting will acquire Kodiak for $3.8 billion in stock and assume $2.2 billion in the target’s debt. The deal is expected to close before year’s end. If completed, Reuters reports that the transaction will help Whiting surpass Harold Hamm’s Continental Resources as the top player in the Bakken. (Forbes recently profiled Hamm as the billionaire fueling America’s economic recovery.)

Foley & Lardner corporate partners Benjamin Garmer III, John Wilson, Jamshed Patel and Patricia Lane are advising Whiting on the deal, along with senior counsel Benjamin Rikkers and leading Canadian firm Stikeman Elliott. A spokeswoman for Stikeman did not respond to a request for the names of the lead lawyers from the firm working on the matter.

Whiting has been a longtime Foley client. Bruce DeBoer is the company’s general counsel, while Philip Doty, a former in-house lawyer at Denver-based accounting firm Ehrhardt Keefe Steiner & Hottman, serves as an independent member of its board of directors.

Dorsey & Whitney is representing Kodiak on the deal through corporate partners Randal Jones and Erin Furman McCrady, tax cochair John Hollinrake Jr. and tax partner Kim Severson, bank finance partner Peter Nelson, labor and employment partner Ryan Mick, employee benefits partner Marianne O’Bara, antitrust cochair Michael Lindsay and associates Clint Foss, Jenn Hu and Jamison Klang.

Gregory Smith, a corporate and securities partner with Canadian firm Miller Thomson, is also advising Kodiak, along with capital markets and mining partner Kevin Sorochan, tax partner Lyne Gaulin and litigation partner Gordon Plottel. (In a bid to snag more natural resources work, Miller Thomson acquired a 30-lawyer firm in Saskatchewan in late 2010.)

Colorado attorneys Rodney Knutson and Herrick Lidstone Jr.—the latter a partner with Greenwood Village-based Burns, Figa & Will—are independent members of the board at Kodiak, which in addition to its Bakken holdings also drills in the Green River Basin in Colorado and Wyoming.

The U.S. recently retained its title as the world’s largest oil producer, holding off Russia and Saudi Arabia for the top spot it first snagged in 2010, according to the International Energy Agency. Last month the Obama administration eased a four-decade ban on U.S. oil exports.